diff options
author | siikamiika <siikamiika@users.noreply.github.com> | 2020-04-17 01:32:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-17 01:32:01 +0300 |
commit | 8c16a6e580bfdd70e27df1816ca90807062cf9b5 (patch) | |
tree | 25f551dfaa68427cd873fbd822abf0f2bfe09b76 /ext/bg/js/search-query-parser-generator.js | |
parent | e6053eefa594524c7adcec4986a5a2c499adf192 (diff) | |
parent | 619df42aedaa8da97d0a16d539b7211349143a0a (diff) |
Merge pull request #456 from siikamiika/parse-text-refactor
Parse text refactor
Diffstat (limited to 'ext/bg/js/search-query-parser-generator.js')
-rw-r--r-- | ext/bg/js/search-query-parser-generator.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/ext/bg/js/search-query-parser-generator.js b/ext/bg/js/search-query-parser-generator.js index 390841c1..9e7ff8aa 100644 --- a/ext/bg/js/search-query-parser-generator.js +++ b/ext/bg/js/search-query-parser-generator.js @@ -36,7 +36,7 @@ class QueryParserGenerator { const termContainer = this._templateHandler.instantiate(preview ? 'term-preview' : 'term'); for (const segment of term) { if (!segment.text.trim()) { continue; } - if (!segment.reading || !segment.reading.trim()) { + if (!segment.reading.trim()) { termContainer.appendChild(this.createSegmentText(segment.text)); } else { termContainer.appendChild(this.createSegment(segment)); @@ -71,7 +71,17 @@ class QueryParserGenerator { for (const parseResult of parseResults) { const optionContainer = this._templateHandler.instantiate('select-option'); optionContainer.value = parseResult.id; - optionContainer.textContent = parseResult.name; + switch (parseResult.source) { + case 'scanning-parser': + optionContainer.textContent = 'Scanning parser'; + break; + case 'mecab': + optionContainer.textContent = `MeCab: ${parseResult.dictionary}`; + break; + default: + optionContainer.textContent = 'Unrecognized dictionary'; + break; + } optionContainer.defaultSelected = selectedParser === parseResult.id; selectContainer.appendChild(optionContainer); } |