We are using Lucene.net beta version - Lucene.net 48. We want to provide support for not like
clause using lucene
query object. We are using WildcardQuery
class for wild card support and using boolean clause as 'BooleanClause.Occur.MUST_NOT'.
It is generating query --> : "-company:lucene*"
.
It has '-' sign before query but it is not returning data where company is not like lucene*
. Ideally, it should return 'elastic', 'mongodb', etc.
WildcardQuery qfWildcard = new WildcardQuery(new Term("company","lucene*"));
BooleanQuery bq = new BooleanQuery();
bq.Add(qfWildcard, BooleanClause.Occur.MUST_NOT);
On other way, WildcardQuery
with MUST
clause is working.
Query --> : "+company:lucene*"
.
It has '+' sign before query and it is returning data where company is like 'lucene*'. It is returning 'lucene', 'lucene.net', etc.
WildcardQuery qfWildcard = new WildcardQuery(new Term("company","lucene*"));
BooleanQuery bq= new BooleanQuery();
bq.Add(qfWildcard, BooleanClause.Occur.MUST);
Please help me, if any one know about the solution using WildcardQuery
class or any other class or any alternative way to solve the issue.
Please also let me know, if there is way to support - 'Is Null' and 'Is Not Null'
clause.