Class LuceneOptimizedQueryParser

java.lang.Object
org.apache.lucene.util.QueryBuilder
org.apache.lucene.queryparser.classic.QueryParserBase
org.apache.lucene.queryparser.classic.QueryParser
com.apple.foundationdb.record.lucene.search.LuceneOptimizedQueryParser
All Implemented Interfaces:
ConfigAwareQueryParser, org.apache.lucene.queryparser.classic.QueryParserConstants, org.apache.lucene.queryparser.flexible.standard.CommonQueryParserConfiguration
Direct Known Subclasses:
LuceneOptimizedStopWordsQueryParser

public class LuceneOptimizedQueryParser extends org.apache.lucene.queryparser.classic.QueryParser implements ConfigAwareQueryParser
Optimized QueryParser that adds the slop for SpanNearQuery as well. So the proximity search based on SpanNearQuery can also work.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.lucene.queryparser.classic.QueryParser

    org.apache.lucene.queryparser.classic.QueryParser.Operator

    Nested classes/interfaces inherited from class org.apache.lucene.util.QueryBuilder

    org.apache.lucene.util.QueryBuilder.TermAndBoost
  • Field Summary

    Fields inherited from class org.apache.lucene.queryparser.classic.QueryParser

    DEFAULT_SPLIT_ON_WHITESPACE, jj_nt, token, token_source

    Fields inherited from class org.apache.lucene.queryparser.classic.QueryParserBase

    AND_OPERATOR, field, OR_OPERATOR

    Fields inherited from class org.apache.lucene.util.QueryBuilder

    analyzer, autoGenerateMultiTermSynonymsPhraseQuery, enableGraphQueries, enablePositionIncrements

    Fields inherited from interface org.apache.lucene.queryparser.classic.QueryParserConstants

    _ESCAPED_CHAR, _NUM_CHAR, _QUOTED_CHAR, _TERM_CHAR, _TERM_START_CHAR, _WHITESPACE, AND, BAREOPER, Boost, CARAT, COLON, DEFAULT, EOF, FUZZY_SLOP, LPAREN, MINUS, NOT, NUMBER, OR, PLUS, PREFIXTERM, QUOTED, Range, RANGE_GOOP, RANGE_QUOTED, RANGE_TO, RANGEEX_END, RANGEEX_START, RANGEIN_END, RANGEIN_START, REGEXPTERM, RPAREN, STAR, TERM, tokenImage, WILDTERM
  • Constructor Summary

    Constructors
    Constructor
    Description
    LuceneOptimizedQueryParser(String field, org.apache.lucene.analysis.Analyzer analyzer, Map<String,org.apache.lucene.queryparser.flexible.standard.config.PointsConfig> pointsConfig)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.lucene.search.Query
    constructFieldWithoutPointsConfig(String field, String queryText, boolean quoted)
     
    org.apache.lucene.search.Query
    constructRangeQueryWithoutPointsConfig(String field, String part1, String part2, boolean startInclusive, boolean endInclusive)
     
    protected org.apache.lucene.search.Query
    getFieldQuery(String field, String queryText, boolean quoted)
     
    protected org.apache.lucene.search.Query
    getFieldQuery(String field, String queryText, int slop)
     
    Map<String,org.apache.lucene.queryparser.flexible.standard.config.PointsConfig>
     
    protected org.apache.lucene.search.Query
    getRangeQuery(String field, String part1, String part2, boolean startInclusive, boolean endInclusive)
     
    final org.apache.lucene.queryparser.classic.Token
     

    Methods inherited from class org.apache.lucene.queryparser.classic.QueryParser

    Clause, Conjunction, disable_tracing, enable_tracing, generateParseException, getNextToken, getSplitOnWhitespace, getToken, Modifiers, MultiTerm, Query, ReInit, ReInit, setAutoGeneratePhraseQueries, setSplitOnWhitespace, Term, TopLevelQuery

    Methods inherited from class org.apache.lucene.queryparser.classic.QueryParserBase

    addClause, addMultiTermClauses, escape, getAllowLeadingWildcard, getAutoGeneratePhraseQueries, getBooleanQuery, getDateResolution, getDefaultOperator, getDeterminizeWorkLimit, getField, getFuzzyMinSim, getFuzzyPrefixLength, getFuzzyQuery, getLocale, getMultiTermRewriteMethod, getPhraseSlop, getPrefixQuery, getRegexpQuery, getTimeZone, getWildcardQuery, init, newBooleanClause, newFieldQuery, newFuzzyQuery, newMatchAllDocsQuery, newPrefixQuery, newRangeQuery, newRegexpQuery, newWildcardQuery, parse, setAllowLeadingWildcard, setDateResolution, setDateResolution, setDefaultOperator, setDeterminizeWorkLimit, setFuzzyMinSim, setFuzzyPrefixLength, setLocale, setMultiTermRewriteMethod, setPhraseSlop, setTimeZone

    Methods inherited from class org.apache.lucene.util.QueryBuilder

    add, analyzeBoolean, analyzeGraphBoolean, analyzeGraphPhrase, analyzeMultiBoolean, analyzeMultiPhrase, analyzePhrase, analyzeTerm, createBooleanQuery, createBooleanQuery, createFieldQuery, createFieldQuery, createMinShouldMatchQuery, createPhraseQuery, createPhraseQuery, createSpanQuery, getAnalyzer, getAutoGenerateMultiTermSynonymsPhraseQuery, getEnableGraphQueries, getEnablePositionIncrements, newBooleanQuery, newGraphSynonymQuery, newMultiPhraseQueryBuilder, newSynonymQuery, newTermQuery, setAnalyzer, setAutoGenerateMultiTermSynonymsPhraseQuery, setEnableGraphQueries, setEnablePositionIncrements

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.lucene.queryparser.flexible.standard.CommonQueryParserConfiguration

    getAnalyzer, getEnablePositionIncrements, setEnablePositionIncrements

    Methods inherited from interface com.apple.foundationdb.record.lucene.search.ConfigAwareQueryParser

    addSlop, attemptConstructFieldQueryWithPointsConfig, attemptConstructRangeQueryWithPointsConfig
  • Constructor Details

    • LuceneOptimizedQueryParser

      public LuceneOptimizedQueryParser(String field, org.apache.lucene.analysis.Analyzer analyzer, @Nonnull Map<String,org.apache.lucene.queryparser.flexible.standard.config.PointsConfig> pointsConfig)
  • Method Details

    • getFieldQuery

      protected org.apache.lucene.search.Query getFieldQuery(String field, String queryText, int slop) throws org.apache.lucene.queryparser.classic.ParseException
      Overrides:
      getFieldQuery in class org.apache.lucene.queryparser.classic.QueryParserBase
      Throws:
      org.apache.lucene.queryparser.classic.ParseException
    • getFieldQuery

      protected org.apache.lucene.search.Query getFieldQuery(String field, String queryText, boolean quoted) throws org.apache.lucene.queryparser.classic.ParseException
      Overrides:
      getFieldQuery in class org.apache.lucene.queryparser.classic.QueryParserBase
      Throws:
      org.apache.lucene.queryparser.classic.ParseException
    • getRangeQuery

      protected org.apache.lucene.search.Query getRangeQuery(String field, String part1, String part2, boolean startInclusive, boolean endInclusive) throws org.apache.lucene.queryparser.classic.ParseException
      Overrides:
      getRangeQuery in class org.apache.lucene.queryparser.classic.QueryParserBase
      Throws:
      org.apache.lucene.queryparser.classic.ParseException
    • getPointsConfig

      @Nonnull public Map<String,org.apache.lucene.queryparser.flexible.standard.config.PointsConfig> getPointsConfig()
      Specified by:
      getPointsConfig in interface ConfigAwareQueryParser
    • constructFieldWithoutPointsConfig

      @Nonnull public org.apache.lucene.search.Query constructFieldWithoutPointsConfig(@Nonnull String field, @Nonnull String queryText, boolean quoted) throws org.apache.lucene.queryparser.classic.ParseException
      Specified by:
      constructFieldWithoutPointsConfig in interface ConfigAwareQueryParser
      Throws:
      org.apache.lucene.queryparser.classic.ParseException
    • constructRangeQueryWithoutPointsConfig

      @Nonnull public org.apache.lucene.search.Query constructRangeQueryWithoutPointsConfig(@Nonnull String field, @Nonnull String part1, @Nonnull String part2, boolean startInclusive, boolean endInclusive) throws org.apache.lucene.queryparser.classic.ParseException
      Specified by:
      constructRangeQueryWithoutPointsConfig in interface ConfigAwareQueryParser
      Throws:
      org.apache.lucene.queryparser.classic.ParseException
    • nextToken

      @Nonnull public final org.apache.lucene.queryparser.classic.Token nextToken()
      Specified by:
      nextToken in interface ConfigAwareQueryParser