Class QueryParser.LuceneQueryParser

java.lang.Object
org.apache.lucene.util.QueryBuilder
org.apache.lucene.queryparser.classic.QueryParserBase
org.apache.lucene.queryparser.classic.QueryParser
org.codelibs.fess.query.parser.QueryParser.LuceneQueryParser
All Implemented Interfaces:
org.apache.lucene.queryparser.classic.QueryParserConstants, org.apache.lucene.queryparser.flexible.standard.CommonQueryParserConfiguration
Enclosing class:
QueryParser

protected static class QueryParser.LuceneQueryParser extends org.apache.lucene.queryparser.classic.QueryParser
Custom Lucene query parser that extends the standard QueryParser to provide additional functionality for quoted queries.
  • 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
    LuceneQueryParser(String f, org.apache.lucene.analysis.Analyzer a)
    Creates a new ExtendableQueryParser instance
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.apache.lucene.search.Query
    getFieldQuery(String field, String queryText, boolean quoted)
    Overrides the field query creation to handle quoted queries specially.
    protected org.apache.lucene.queryparser.ext.Extensions.Pair<String,String>
    splitField(String defaultField, String field)
    Splits a field name into its components.

    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, trace_enabled

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

    addClause, addMultiTermClauses, escape, getAllowLeadingWildcard, getAutoGeneratePhraseQueries, getBooleanQuery, getDateResolution, getDefaultOperator, getDeterminizeWorkLimit, getField, getFieldQuery, getFuzzyDistance, getFuzzyMinSim, getFuzzyPrefixLength, getFuzzyQuery, getLocale, getMultiTermRewriteMethod, getPhraseSlop, getPrefixQuery, getRangeQuery, 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, 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
  • Constructor Details

    • LuceneQueryParser

      public LuceneQueryParser(String f, org.apache.lucene.analysis.Analyzer a)
      Creates a new ExtendableQueryParser instance
      Parameters:
      f - the default query field
      a - the analyzer used to find terms in a query string
  • Method Details

    • getFieldQuery

      protected org.apache.lucene.search.Query getFieldQuery(String field, String queryText, boolean quoted) throws org.apache.lucene.queryparser.classic.ParseException
      Overrides the field query creation to handle quoted queries specially. For quoted queries on the default field, creates a phrase query instead of a term query.
      Overrides:
      getFieldQuery in class org.apache.lucene.queryparser.classic.QueryParserBase
      Parameters:
      field - the field to query
      queryText - the query text
      quoted - whether the query is quoted
      Returns:
      the created Query object
      Throws:
      org.apache.lucene.queryparser.classic.ParseException - if the query cannot be parsed
    • splitField

      protected org.apache.lucene.queryparser.ext.Extensions.Pair<String,String> splitField(String defaultField, String field)
      Splits a field name into its components.
      Parameters:
      defaultField - the default field name
      field - the field name to split
      Returns:
      a Pair containing the field name and extension key