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 Wed, 08 Nov 2006 01:04:45 GMT

Hi Chris,

   I have made some modification for the codes that I have posted yesterday.

      reader = IndexReader.open(DsConstant.indexDir);
			Searcher searcher = new IndexSearcher(reader);
			Analyzer analyzer = new StandardAnalyzer();
			QueryParser parser = new QueryParser(DsConstant.idxFileContent,
analyzer);
			
			Query query1 = parser.parse(searchString1);
			Query query2 = parser.parse(searchString2);
			
			filter = new Filter(){
				public BitSet bits (IndexReader reader){
					System.out.println("inside bit set");
					
					BitSet bits = new BitSet(reader.maxDoc());
					System.out.println("bits size is ::: " +bits.size());
					for(int i=start; (i<end && i<bits.size()); i++) 
					{
						bits.set(i);
				    }
					
					return bits;
				}
			};
			
			BooleanQuery bq = new BooleanQuery();
		    query1 = new FilteredQuery(new MatchAllDocQuery(), filter);
		    bq.add(query1, BooleanClause.Occur.MUST);
		    bq.add(query2, BooleanClause.Occur.MUST);
			
		    searchHits = searcher.search(bq);

   Can you pls point me out which part I have done it wrong. Thanks.


regards,
Wooi Meng
-- 
View this message in context: http://www.nabble.com/Filter-query-method-tf2586547.html#a7230940
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