Class LuceneAutoCompleteQueryClause

java.lang.Object
com.apple.foundationdb.record.lucene.LuceneQueryClause
com.apple.foundationdb.record.lucene.LuceneAutoCompleteQueryClause
All Implemented Interfaces:
PlanHashable

@API(EXPERIMENTAL) public class LuceneAutoCompleteQueryClause extends LuceneQueryClause
Auto complete query clause from string using Lucene search syntax.
  • Field Details

    • LOGGER

      public static final org.slf4j.Logger LOGGER
  • Constructor Details

    • LuceneAutoCompleteQueryClause

      public LuceneAutoCompleteQueryClause(@Nonnull String search, boolean isParameter, @Nonnull Iterable<String> fields)
  • Method Details

    • getSearch

      @Nonnull public String getSearch()
    • isParameter

      public boolean isParameter()
    • bind

      public LuceneQueryClause.BoundQuery bind(@Nonnull FDBRecordStoreBase<?> store, @Nonnull Index index, @Nonnull EvaluationContext context)
      Specified by:
      bind in class LuceneQueryClause
    • getPlannerGraphDetails

      public void getPlannerGraphDetails(@Nonnull com.google.common.collect.ImmutableList.Builder<String> detailsBuilder, @Nonnull com.google.common.collect.ImmutableMap.Builder<String,com.apple.foundationdb.record.query.plan.cascades.explain.Attribute> attributeMapBuilder)
      Specified by:
      getPlannerGraphDetails in class LuceneQueryClause
    • planHash

      public int planHash(@Nonnull PlanHashable.PlanHashMode mode)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • buildPhraseQueryWithPrefix

      @Nonnull public static org.apache.lucene.search.Query buildPhraseQueryWithPrefix(@Nonnull org.apache.lucene.queryparser.classic.QueryParser parser, @Nonnull Collection<String> fieldNames, @Nonnull String phrase, @Nullable String prefix, boolean useGapForPrefix)
      Constructs a query to match a phrase search, with the last token treated as a prefix. This is to match "united states of" against "United States of America"
      Parameters:
      parser - Lucene parser with given fields and analyzer
      fieldNames - the fields to match against
      phrase - the phrase part of the search key
      prefix - the prefix (last token) of the search key
      useGapForPrefix - option to represent the last token as a gap (if it's a stopword)
      Returns:
      a Lucene Query that matches phrase using the last token as a prefix
    • buildQueryForPhraseMatching

      @Nonnull public static org.apache.lucene.search.Query buildQueryForPhraseMatching(@Nonnull org.apache.lucene.queryparser.classic.QueryParser parser, @Nonnull Collection<String> fieldNames, @Nonnull String searchKey)