diff --git a/app/static/js/CorpusAnalysis/QueryBuilder/GeneralFunctionsQueryBuilder.js b/app/static/js/CorpusAnalysis/QueryBuilder/GeneralFunctionsQueryBuilder.js index d6e09303..28f2aeea 100644 --- a/app/static/js/CorpusAnalysis/QueryBuilder/GeneralFunctionsQueryBuilder.js +++ b/app/static/js/CorpusAnalysis/QueryBuilder/GeneralFunctionsQueryBuilder.js @@ -233,7 +233,7 @@ class GeneralFunctionsQueryBuilder { let expertModeInputField = document.querySelector('#corpus-analysis-concordance-form-query'); expertModeInputField.value = ''; let queryBuilderInputFieldValue = Utils.unescape(document.querySelector('#corpus-analysis-concordance-query-preview').innerHTML.trim()); - if (queryBuilderInputFieldValue !== "") { + if (queryBuilderInputFieldValue !== "" && queryBuilderInputFieldValue !== ";") { expertModeInputField.value = queryBuilderInputFieldValue; } } @@ -246,6 +246,7 @@ class GeneralFunctionsQueryBuilder { this.queryChipFactory(chipElement['type'], chipElement['pretty'], chipElement['query']); } } + parseTextToChip(query) { const parsingElementDict = { @@ -301,12 +302,11 @@ class GeneralFunctionsQueryBuilder { pretty: '', type: 'token-incidence-modifier' } - } let chipElements = []; - - const regex = new RegExp(`|<\/s>|||<\\\/ent(_type)?>|\\[(word|lemma|pos|simple_pos)=(("[^"]+")|(\\u0027[^\\u0027]+\\u0027)) ?(%c)? ?((\\&|\\|) ?(word|lemma|pos|simple_pos)=(("[^"]+")|(\\u0027[^\\u0027]+\\u0027)) ?(%c)? ?)*\\]|:: ?match\\.text_[A-Za-z]+="[^"]+"|(? `(${pattern})`).join('|'); + const regex = new RegExp(regexPattern, 'gi'); let match; while ((match = regex.exec(query)) !== null) { @@ -318,6 +318,7 @@ class GeneralFunctionsQueryBuilder { for (let [pattern, chipElement] of Object.entries(parsingElementDict)) { const parsingRegex = new RegExp(pattern, 'gi'); if (parsingRegex.exec(stringElement)) { + // Creating the pretty text for the chip element let prettyText; switch (pattern) { case '':