summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-03-07 14:20:08 +0200
committersiikamiika <siikamiika@users.noreply.github.com>2020-03-07 14:20:08 +0200
commit387e93dbbc3ebe13f585860da4df0eeda833d49a (patch)
tree3e4e047afe7cd4b381208d36b9b5bdd77002b0ca /ext
parent58d734b8f79a9d859063ef70afe1ff367afe7a29 (diff)
use docSentenceExtract in QueryParser
Diffstat (limited to 'ext')
-rw-r--r--ext/bg/js/search-query-parser.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/bg/js/search-query-parser.js b/ext/bg/js/search-query-parser.js
index 11c7baa2..241dda87 100644
--- a/ext/bg/js/search-query-parser.js
+++ b/ext/bg/js/search-query-parser.js
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-/*global apiTermsFind, apiOptionsSet, apiTextParse, apiTextParseMecab, TextScanner, QueryParserGenerator*/
+/*global apiTermsFind, apiOptionsSet, apiTextParse, apiTextParseMecab, TextScanner, QueryParserGenerator, docSentenceExtract*/
class QueryParser extends TextScanner {
constructor(search) {
@@ -55,12 +55,14 @@ class QueryParser extends TextScanner {
const {definitions, length} = await apiTermsFind(searchText, {}, this.search.getOptionsContext());
if (definitions.length === 0) { return null; }
+ const sentence = docSentenceExtract(textSource, this.options.anki.sentenceExt);
+
textSource.setEndOffset(length);
this.search.setContent('terms', {definitions, context: {
focus: false,
disableHistory: cause === 'mouse',
- sentence: {text: searchText, offset: 0},
+ sentence,
url: window.location.href
}});