Class SuggesterUtils

java.lang.Object
org.opengrok.suggest.SuggesterUtils

public class SuggesterUtils extends Object
Provides some useful utility methods to be used in suggester module.
  • Field Details

    • NORMALIZED_DOCUMENT_FREQUENCY_MULTIPLIER

      public static final int NORMALIZED_DOCUMENT_FREQUENCY_MULTIPLIER
      See Also:
  • Method Details

    • intoTerms

      public static List<org.apache.lucene.index.Term> intoTerms(org.apache.lucene.search.Query query)
      Decomposes the provided query into 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 provided query into terms with the exception of PhraseQuery. Is useful when determining which terms should not be suggested. PhraseQuery is 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 query
      suggesterQuery - suggester query
      Returns:
      true if complex, false otherwise