|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.queryParser.QueryParser com.jalios.jcms.search.SpellSuggestQueryParser
public class SpellSuggestQueryParser
This QueryParser parse a search string and build a new lucene query using suggested words instead of Warning: it can be quite time consuming as it trigger a search in the spell checker for each term of the query.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.lucene.queryParser.QueryParser |
---|
org.apache.lucene.queryParser.QueryParser.Operator |
Field Summary | |
---|---|
static String |
REVISION
|
Fields inherited from class org.apache.lucene.queryParser.QueryParser |
---|
AND_OPERATOR, jj_nt, OR_OPERATOR, token, token_source |
Fields inherited from interface org.apache.lucene.queryParser.QueryParserConstants |
---|
_ESCAPED_CHAR, _NUM_CHAR, _QUOTED_CHAR, _TERM_CHAR, _TERM_START_CHAR, _WHITESPACE, AND, Boost, CARAT, COLON, DEFAULT, EOF, FUZZY_SLOP, LPAREN, MINUS, NOT, NUMBER, OR, PLUS, PREFIXTERM, QUOTED, RangeEx, RANGEEX_END, RANGEEX_GOOP, RANGEEX_QUOTED, RANGEEX_START, RANGEEX_TO, RangeIn, RANGEIN_END, RANGEIN_GOOP, RANGEIN_QUOTED, RANGEIN_START, RANGEIN_TO, RPAREN, STAR, TERM, tokenImage, WILDTERM |
Constructor Summary | |
---|---|
SpellSuggestQueryParser(String field,
org.apache.lucene.analysis.Analyzer analyzer,
SpellChecker spellChecker,
org.apache.lucene.index.IndexReader reader,
QueryHandler qh)
Construct a new SpellSuggestQueryParser using the given params. |
Method Summary | |
---|---|
protected org.apache.lucene.search.Query |
getFieldQuery(String field,
String queryText)
|
boolean |
hasSuggestedQuery()
Check if the suggestions were used during last parse. |
org.apache.lucene.search.Query |
parse(String query)
|
Methods inherited from class org.apache.lucene.queryParser.QueryParser |
---|
addClause, addClause, Clause, Conjunction, disable_tracing, enable_tracing, escape, generateParseException, getAllowLeadingWildcard, getAnalyzer, getBooleanQuery, getBooleanQuery, getBooleanQuery, getBooleanQuery, getDateResolution, getDefaultOperator, getEnablePositionIncrements, getField, getFieldQuery, getFuzzyMinSim, getFuzzyPrefixLength, getFuzzyQuery, getLocale, getLowercaseExpandedTerms, getMultiTermRewriteMethod, getNextToken, getPhraseSlop, getPrefixQuery, getRangeCollator, getRangeQuery, getToken, getUseOldRangeQuery, getWildcardQuery, main, Modifiers, newBooleanClause, newBooleanQuery, newFuzzyQuery, newMatchAllDocsQuery, newMultiPhraseQuery, newPhraseQuery, newPrefixQuery, newRangeQuery, newTermQuery, newWildcardQuery, Query, ReInit, ReInit, setAllowLeadingWildcard, setDateResolution, setDateResolution, setDefaultOperator, setEnablePositionIncrements, setFuzzyMinSim, setFuzzyPrefixLength, setLocale, setLowercaseExpandedTerms, setMultiTermRewriteMethod, setPhraseSlop, setRangeCollator, setUseOldRangeQuery, Term, TopLevelQuery |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String REVISION
Constructor Detail |
---|
public SpellSuggestQueryParser(String field, org.apache.lucene.analysis.Analyzer analyzer, SpellChecker spellChecker, org.apache.lucene.index.IndexReader reader, QueryHandler qh)
field
- default field to use (see QueryParser.QueryParser(java.lang.String, org.apache.lucene.analysis.Analyzer)
)
used also by the spell checker method
SpellChecker.suggestSimilar(String, int, IndexReader, String, boolean)
.analyzer
- analyzer to use (see QueryParser.QueryParser(java.lang.String, org.apache.lucene.analysis.Analyzer)
)spellChecker
- the spellChecker instance to find suggestion, MUST NOT BE NULL.reader
- the IndexReader to use when calling the spell checker method
SpellChecker.suggestSimilar(String, int, IndexReader, String, boolean)
,
allows suggestion to be made only if the suggested term is more frequent in
the index than the searched term.qh
- the QueryHandler that was used for this query.Method Detail |
---|
protected org.apache.lucene.search.Query getFieldQuery(String field, String queryText) throws org.apache.lucene.queryParser.ParseException
getFieldQuery
in class org.apache.lucene.queryParser.QueryParser
org.apache.lucene.queryParser.ParseException
public org.apache.lucene.search.Query parse(String query) throws org.apache.lucene.queryParser.ParseException
parse
in class org.apache.lucene.queryParser.QueryParser
org.apache.lucene.queryParser.ParseException
public boolean hasSuggestedQuery()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |