Skip to content

Commit

Permalink
add back auto-complete query analyzer (so that, say, synonyms do not …
Browse files Browse the repository at this point in the history
…interfere with auto-complete queries)
  • Loading branch information
alecgrieser committed May 25, 2022
1 parent f659f62 commit c8624b0
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public class LuceneIndexMaintainer extends StandardIndexMaintainer {
private static final Logger LOG = LoggerFactory.getLogger(LuceneIndexMaintainer.class);
private final FDBDirectoryManager directoryManager;
private final AnalyzerChooser indexAnalyzerChooser;
private final AnalyzerChooser autoCompleteQueryAnalyzerChooser;
protected static final String PRIMARY_KEY_FIELD_NAME = "p"; // TODO: Need to find reserved names..
protected static final String PRIMARY_KEY_SEARCH_NAME = "s"; // TODO: Need to find reserved names..
private final Executor executor;
Expand All @@ -103,6 +104,7 @@ public LuceneIndexMaintainer(@Nonnull final IndexMaintainerState state, @Nonnull
this.executor = executor;
this.directoryManager = FDBDirectoryManager.getManager(state);
this.indexAnalyzerChooser = LuceneAnalyzerRegistryImpl.instance().getLuceneAnalyzerChooserPair(state.index, LuceneAnalyzerType.FULL_TEXT).getLeft();
this.autoCompleteQueryAnalyzerChooser = LuceneAnalyzerRegistryImpl.instance().getLuceneAnalyzerChooserPair(state.index, LuceneAnalyzerType.AUTO_COMPLETE).getRight();
this.autoCompleteEnabled = state.index.getBooleanOption(LuceneIndexOptions.AUTO_COMPLETE_ENABLED, false);
this.highlightForAutoCompleteIfEnabled = state.index.getBooleanOption(LuceneIndexOptions.AUTO_COMPLETE_HIGHLIGHT, false);
}
Expand Down Expand Up @@ -144,7 +146,7 @@ public RecordCursor<IndexEntry> scan(@Nonnull final IndexScanBounds scanBounds,
.addLogInfo(LogMessageKeys.INDEX_NAME, state.index.getName());
}
LuceneScanAutoComplete scanAutoComplete = (LuceneScanAutoComplete)scanBounds;
Analyzer analyzer = indexAnalyzerChooser.chooseAnalyzer(scanAutoComplete.getKeyToComplete()).getAnalyzer();
Analyzer analyzer = autoCompleteQueryAnalyzerChooser.chooseAnalyzer(scanAutoComplete.getKeyToComplete()).getAnalyzer();
return new LuceneAutoCompleteResultCursor(scanAutoComplete.getKeyToComplete(),
executor, scanProperties, analyzer, state, scanAutoComplete.getGroupKey(), highlightForAutoCompleteIfEnabled);
}
Expand Down

0 comments on commit c8624b0

Please sign in to comment.