Class LuceneOptimizedStopWordsQueryParser
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
com.apple.foundationdb.record.lucene.search.LuceneOptimizedStopWordsQueryParser
- All Implemented Interfaces:
ConfigAwareQueryParser,org.apache.lucene.queryparser.classic.QueryParserConstants,org.apache.lucene.queryparser.flexible.standard.CommonQueryParserConfiguration
A
QueryParser that changes the way by which stop words in the query are handled.
Stop words are not indexed, which means that a query for +the will not match a document that has "the" in it
(because of the "+" in the query and the fact that the "the" is not indexed).
In the cases where users are adding search terms that are prefixes of stop words (e.g. +the*) we want to match
documents that have suffixes of the stop words (e.g. "these") but not be blocked by the stop words themselves.
As a result, this parser relaxes the query requirement (removed the "+") from stop words search terms.
Note that normally, for search terms that are not prefix queries (ones that do not end with "*"), the analyzer will handle
the stop words removal, so this is not necessary here.-
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
ConstructorsConstructorDescriptionLuceneOptimizedStopWordsQueryParser(String field, org.apache.lucene.analysis.Analyzer analyzer, Map<String, org.apache.lucene.queryparser.flexible.standard.config.PointsConfig> pointsConfig, org.apache.lucene.analysis.CharArraySet stopWords) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.lucene.search.BooleanClausenewBooleanClause(org.apache.lucene.search.Query q, org.apache.lucene.search.BooleanClause.Occur occur) Methods inherited from class com.apple.foundationdb.record.lucene.search.LuceneOptimizedQueryParser
constructFieldWithoutPointsConfig, constructRangeQueryWithoutPointsConfig, getFieldQuery, getFieldQuery, getPointsConfig, getRangeQuery, nextTokenMethods 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, TopLevelQueryMethods 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, 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, createSpanQuery, 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, setEnablePositionIncrementsMethods inherited from interface com.apple.foundationdb.record.lucene.search.ConfigAwareQueryParser
addSlop, attemptConstructFieldQueryWithPointsConfig, attemptConstructRangeQueryWithPointsConfig
-
Constructor Details
-
LuceneOptimizedStopWordsQueryParser
-
-
Method Details
-
newBooleanClause
protected org.apache.lucene.search.BooleanClause newBooleanClause(org.apache.lucene.search.Query q, org.apache.lucene.search.BooleanClause.Occur occur) - Overrides:
newBooleanClausein classorg.apache.lucene.queryparser.classic.QueryParserBase
-