You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by thturk <ta...@hotmail.com> on 2018/08/27 08:58:43 UTC

Create Best Query For My Case

Hey i am trying to  create most effective query which should work like in a
sql " where .... and .... and .... "
i have tried BoolQuery 

boolQueryBuilder.add(new BooleanClause(new TermQuery(new Term(fieldType,
Integer.toString(luceneType.getValue()))), Occur.FILTER));

boolQueryBuilder.add(new BooleanClause(new FuzzyQuery(new Term(fieldCity,
city), 0), Occur.FILTER));

boolQueryBuilder.add(new BooleanClause(new WildcardQuery(new Term(fieldText,
str)), Occur.SHOULD));
boolQueryBuilder.add(new FuzzyQuery(new Term(fieldText, str), fuzzy),
Occur.SHOULD);
boolQueryBuilder.add(new FuzzyQuery(new Term(fieldText, mergedKeyword),
fuzzy), Occur.SHOULD);

The basic queries for one of my code.

But prublem here its not working like "AND" operand int SQL,

"FILTER" return me all values and  if "SHOULD" queries not matched any
result then its return all Documents in "FILTER" also "MUST" doing same,

Can someone tell me how to create this kind of queries which will return
less result and mostly correct results which i need. 



--
Sent from: http://lucene.472066.n3.nabble.com/Lucene-Java-Developer-f564358.html

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org