lucene-dev mailing list archives

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

Hi,
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,
Field.Index.NOT_ANALYZED_NO_NORMS));

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",
analyzer);
Query query = qp.parse(searchString);
Filter filter = new TermRangeFilter("sentiment", "positive", "positive",
true, true);
topDocs = searcher.search(query, 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......

thanks
Dyutiman

-- 
View this message in context: http://old.nabble.com/Lucene-Filter-tp27756577p27756577.html
Sent from the Lucene - Java Developer mailing list archive at Nabble.com.


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


Mime
View raw message