Hello,
I am extending AnalyzingInfixSuggester for use with my suggester where I
change the query to be a AND rather than an OR in the finishQuery(..)
method.
ie
/**
* Subclass can override this to tweak the Query before searching.
*/
protected Query finishQuery(Builder in, boolean allTermsRequired) {
// Update contexts to be ANDs (MUST) rather than ORs (SHOULD)
for (BooleanClause booleanClause : in.build().clauses()) {
// Change the contexts to be MUST (will be the only
BooleanQuery and others will be TermQuery)
if (booleanClause.getQuery() instanceof BooleanQuery) {
BooleanQuery bq = (BooleanQuery) booleanClause.getQuery();
for (BooleanClause bc : bq) {
bc.setOccur(BooleanClause.Occur.MUST);
}
// We are done
break;
}
}
return in.build();
}
It says that BooleanClause.setOccur(..) is depreciated and will be *immutable
in 6.0*, how would I then be able to do this?
http://lucene.apache.org/core/5_3_0/core/org/apache/lucene/search/BooleanClause.html
Cheers Greg