Hi Wooi Meng,
I don't understand this code.
In particular, searchString1 has no efect, and not clear what are start and
end.
spinergywmy <[EMAIL PROTECTED]> wrote on 07/11/2006 17:04:45:
> Query query1 = parser.parse(searchString1);
> Query query2 = parser.parse(searchString2);
>
> filter = new Filter(){
> public BitSet bits (IndexReader reader){
> BitSet bits = new BitSet(reader.maxDoc());
> 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);
Anyhow, if you do not cache the results of the first search, two simple
options are:
(1) score by both str1 and str2:
Query query1 = parser.parse(searchString1);
Query query2 = parser.parse(searchString2);
BooleanQuery q = new BooleanQuery();
q.add(query1, BooleanClause.Occur.MUST);
q.add(query2, BooleanClause.Occur.MUST);
Hits searchHits = searcher.search(q);
(2) score ony by str, filter by str1:
Query query1 = parser.parse(searchString1);
Filter f1 = new QueryFilter(query1);
Query q2 = parser.parse(searchString2);
Hits searchHits = searcher.search(q2,f1);
I would start with this, and go for caching only if performance issues
justify that.
Doron
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]