lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dyutiman <>
Subject Lucene Filter
Date Tue, 02 Mar 2010 14:35:43 GMT

I am new in this forum and new to Lucene also. I m getting some issue while
trying to filter my Lucene result.

While creating the index I am creating a field called sentiment and possible
values are 'positive', 'negative' & 'neutral', I am indexing this field like 
doc.add(new Field("sentiment", sentiment, Field.Store.YES,

Now I want to search within my index but get only positive sentiment results
for the searched string.
For this I am doing something like this :

QueryParser qp = new QueryParser(Version.LUCENE_CURRENT, "contents",
Query query = qp.parse(searchString);
Filter filter = new TermRangeFilter("sentiment", "positive", "positive",
true, true);
topDocs =, filter, 20);

But I am getting results mixed with all 3 sentiments. I tried other filters
also but the result is same. 
Anybody got any solutions for me please help......


View this message in context:
Sent from the Lucene - Java Developer mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message