Package org.opengrok.suggest
Class SuggesterUtils
java.lang.Object
org.opengrok.suggest.SuggesterUtils
Provides some useful utility methods to be used in suggester module.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic List<org.apache.lucene.index.Term> intoTerms(org.apache.lucene.search.Query query) Decomposes the providedqueryinto terms.static List<org.apache.lucene.index.Term> intoTermsExceptPhraseQuery(org.apache.lucene.search.Query query) Decomposes the providedqueryinto terms with the exception ofPhraseQuery.static booleanisComplexQuery(org.apache.lucene.search.Query query, SuggesterQuery suggesterQuery) Determines if the query is deemed complex by the suggester standards.
-
Field Details
-
NORMALIZED_DOCUMENT_FREQUENCY_MULTIPLIER
public static final int NORMALIZED_DOCUMENT_FREQUENCY_MULTIPLIER- See Also:
-
-
Method Details
-
intoTerms
Decomposes the providedqueryinto terms.- Parameters:
query- query to decompose- Returns:
- terms that were in the
query
-
intoTermsExceptPhraseQuery
public static List<org.apache.lucene.index.Term> intoTermsExceptPhraseQuery(org.apache.lucene.search.Query query) Decomposes the providedqueryinto terms with the exception ofPhraseQuery. Is useful when determining which terms should not be suggested.PhraseQueryis exempted because not suggesting some term which were contained in it is invalid.- Parameters:
query- query to decompose- Returns:
- terms that were in the
query
-
isComplexQuery
public static boolean isComplexQuery(org.apache.lucene.search.Query query, SuggesterQuery suggesterQuery) Determines if the query is deemed complex by the suggester standards. Complex means that it needs to search in the index rather than WFST data structure.- Parameters:
query- dependent querysuggesterQuery- suggester query- Returns:
trueif complex,falseotherwise
-