From 3808ae229591c43f921a6e7afc87bc19a6b74ae3 Mon Sep 17 00:00:00 2001 From: daniele caldarini Date: Fri, 17 May 2024 18:26:18 +0200 Subject: [PATCH] Issue #940: fixed BaseAutoCompleteAnnotator and added rule for Autocomplete case --- .../datasource/searcher/SearcherService.java | 14 ++------------ .../annotator/BaseAutoCompleteAnnotator.java | 2 +- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/core/app/datasource/src/main/java/io/openk9/datasource/searcher/SearcherService.java b/core/app/datasource/src/main/java/io/openk9/datasource/searcher/SearcherService.java index 53b611140..ad5ef6a0c 100644 --- a/core/app/datasource/src/main/java/io/openk9/datasource/searcher/SearcherService.java +++ b/core/app/datasource/src/main/java/io/openk9/datasource/searcher/SearcherService.java @@ -544,20 +544,10 @@ public Uni queryAnalysis(QueryAnalysisRequest request) { for (SemanticType maps : semanticTypeList) { for (Map map : maps) { Object tokenType = map.get("tokenType"); - String value = (String) map.get("value"); int startPos = maps.getPos().get(0); - int endPos = maps.getPos().get(1); - logger.info(startPos); -// if (!value.startsWith(searchText) -// && (tokenType.equals("TEXT"))) { -// continue; -// } - - if (startPos > 0 && searchText.contains(value)) { - continue; - } + Object keywordKey = map.get("keywordKey"); - if (endPos > 8) { + if (startPos > 0 || keywordKey != null) { continue; } diff --git a/core/app/datasource/src/main/java/io/openk9/datasource/searcher/queryanalysis/annotator/BaseAutoCompleteAnnotator.java b/core/app/datasource/src/main/java/io/openk9/datasource/searcher/queryanalysis/annotator/BaseAutoCompleteAnnotator.java index 7d34499da..8c35c053a 100644 --- a/core/app/datasource/src/main/java/io/openk9/datasource/searcher/queryanalysis/annotator/BaseAutoCompleteAnnotator.java +++ b/core/app/datasource/src/main/java/io/openk9/datasource/searcher/queryanalysis/annotator/BaseAutoCompleteAnnotator.java @@ -259,7 +259,7 @@ private boolean _arrayContains( @Override public int getLastTokenCount() { - return 5; + return 6; } } \ No newline at end of file