problem is that i am getting back all of the results with matches on
fieldCity, whether i have a match on fieldText or not, and i want all
results to have at least one match on fieldText.
What i have now is basically: +city text1 text2 text3. The only term
required to match is the city. The rest of the term will impact the score,
but won't restrict the result set. If i want to make sure i get at least one
fieldText match, i could change the query to look more like this: +city
+(text1 text2 text3):
BooleanQuery fieldTextSubQuery = new BooleanQuery.Builder()
.add(new WildcardQuery(new Term(fieldText, str), Occur.SHOULD)
.add(new FuzzyQuery(new Term(fieldText, strTemp), fuzzy), Occur.SHOULD)
.add(new FuzzyQuery(new Term(fieldText, mergedKeyword), fuzzy),
Occur.SHOULD)
.build();
BooleanQuery finalQuery = new BooleanQuery.Builder()
.add(new FuzzyQuery(new Term(fieldCity, city), 0), Occur.FILTER)
.add(fieldTextSubQuery, Occur.MUST)
.build();
When i changed my query to this. Final one. I get results which i wanted
--
Sent from: http://lucene.472066.n3.nabble.com/Lucene-Java-Users-f532864.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]