Package org.codelibs.fess.query.parser
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.OperatorNested 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_sourceFields inherited from class org.apache.lucene.queryparser.classic.QueryParserBase
AND_OPERATOR, field, OR_OPERATORFields inherited from class org.apache.lucene.util.QueryBuilder
analyzer, autoGenerateMultiTermSynonymsPhraseQuery, enableGraphQueries, enablePositionIncrementsFields 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
ConstructorsConstructorDescriptionLuceneQueryParser(String f, org.apache.lucene.analysis.Analyzer a) Creates a newExtendableQueryParserinstance -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.lucene.search.QuerygetFieldQuery(String field, String queryText, boolean quoted) Overrides the field query creation to handle quoted queries specially.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_enabledMethods 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, setTimeZoneMethods 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, setEnablePositionIncrementsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.lucene.queryparser.flexible.standard.CommonQueryParserConfiguration
getAnalyzer, getEnablePositionIncrements, setEnablePositionIncrements
-
Constructor Details
-
LuceneQueryParser
Creates a newExtendableQueryParserinstance- Parameters:
f- the default query fielda- 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:
getFieldQueryin classorg.apache.lucene.queryparser.classic.QueryParserBase- Parameters:
field- the field to queryqueryText- the query textquoted- 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 namefield- the field name to split- Returns:
- a Pair containing the field name and extension key
-