lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spinergywmy <spinergy...@gmail.com>
Subject Re: Filter query method
Date Tue, 07 Nov 2006 05:44:07 GMT

Hi Chris,

   My scenario is:

      I will key in the first search value in the text box, then the first
search result will be return. Next, I will clear the first search value and
key in the second search value within the same text box. The 2nd search
value will search the first result, for instance, my first result found 3
records, after the 2nd search is performed, it should be return 1 record.
Meaning the first result is searched from the index folder, while 2nd search
should not search the index directory again.

   I hope the scenario above make sense to you. 

   Below a the codes that I have written, hope you can point out which part
I m done wrong. Thanks

      reader = IndexReader.open(DsConstant.indexDir);
		   Searcher searcher = new IndexSearcher(reader);
		   Analyzer analyzer = new StandardAnalyzer();
		   QueryParser parser = new QueryParser(DsConstant.idxFileContent,
analyzer);
		   Query query = parser.parse(searchString);
			
		   BooleanQuery bq = new BooleanQuery();
		   query = new FilteredQuery(new MatchAllDocQuery(), new
SingleDocTestFilter(0));
		   bq.add(query, BooleanClause.Occur.MUST);
		   query = new FilteredQuery(new MatchAllDocQuery(), new
SingleDocTestFilter(0));
		   bq.add(query, BooleanClause.Occur.MUST);
		   
                   searchHits = searcher.search(query);

   Unfortunately, the codes above doesn't return any result. Hope to hear
from you again.


regards,
Wooi Meng
-- 
View this message in context: http://www.nabble.com/Filter-query-method-tf2586547.html#a7212918
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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


Mime
View raw message