lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lee_G...@emc.com
Subject RE: best way to get specific results
Date Mon, 18 Sep 2006 15:11:53 GMT
Thanks for the info on this. Since I should use the search function that
returns TopDocs, I was wondering what was the proper way to create a
Weight object to pass into the search function. 

There are 2 functions in the Query class that I see: createWeight and
weight, which both return a Weight object. Is there a difference between
these 2, and which one should I use?

Once I have a Weight object named, for example, w, do I just use the
search function as this?

IndexSearcher is = new IndexSearcher(fsDir);
Query q = ...
Weight w = q.createWeight(is); or Weight w = q.weight(is);
is.search(w, null, 100); // no filter, want top 100 docs

For the case with a filter, would it be:
is.search(w, f, 100);

Thanks
Gary

-----Original Message-----
From: Chris Hostetter [mailto:hossman_lucene@fucit.org] 
Sent: Saturday, September 16, 2006 07:22 AM
To: java-user@lucene.apache.org
Subject: RE: best way to get specific results

: IndexSearcher.search(Query, Filter) method). Im just wrapping a
: ConstantScoreQuery around the filter, and passing it into the
: IndexSearcher.search(Query) method to return a Hits object. Then Im
: asking for the 500th to 550th doc in the Hits object.
:
: Would such a case still cause Hits to rexecute over and over again on
: higher numbered results? Or is this different because Im using a

yes... it doesn't matter what type of query you use ... Hits is not a
good idea if you wnat results really far down the list.




-Hoss


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


---------------------------------------------------------------------
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