Thanks for your valuable suggestions to me.. I am very much glad to you for
this response. Now I understood where I am going wrong so I will try use the
first solution given by you 

Thanks 
Ravi Kumar Jaladanki


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chris Hostetter
Sent: Thursday, January 19, 2006 12:51 PM
To: java-user@lucene.apache.org
Subject: RE: :intersection of two hits objects:


The first thing you need to keep in mind, is that a Hits object doesn't
"contain" results.  The Hits class is provided as a convincent way to
access results in order, that provides some prefecthing of ids/scores, and
caching of doc stored fields.

Iterating over an entire Hits object is *never* a good idea.
Depending on how big your result set is, iterating over every doc in the
results with a Hits object will re-execute your search over and over again
as you reach the end of it's buffer.

If it's not entirely obvious yet: there is no way to make a Hits object
and "add" or "remove" documents to/from it.   all a Hits objects has in it
is your orriginal Query, a refrnece to your searcher, and a cache.


if you need a Hits obejct ot contain only the results that can be found in
both of two queries A and B, then you should do one of two things:

  1) combine A and B in a boolean query ... this is the "right" option if
you want the scores in your results to be based on the aggregate scores
from A and B.

  2) execute A filtered by B (or B filtered by A) ... this is the "right"
option if you want the scores in your results to be based on just one
query ... and the other should only be used to restrict the results.


if you don't have the orriginal queries A and B, and all you have is the
Hits that resulted from those queries ... then i suggest you change your
app.



: Date: Thu, 19 Jan 2006 11:42:41 +0530
: From: Ravi <[EMAIL PROTECTED]>
: Reply-To: java-user@lucene.apache.org
: To: java-user@lucene.apache.org
: Subject: RE: :intersection of two hits objects:
:
: Thanks for your help ,
:
: I am able to get the record numbers in BitSet object but how to iterate in
: the first hits1 object with the bitset object and retain only those
: documents  which contains ids existed in bitset object..
:
:
: Thanks
: Ravi Kumar jaladanki
:
: -----Original Message-----
: From: Dave Kor [mailto:[EMAIL PROTECTED]
: Sent: Thursday, January 19, 2006 7:01 AM
: To: java-user@lucene.apache.org
: Subject: Re: :intersection of two hits objects:
:
: On 1/18/06, Ravi <[EMAIL PROTECTED]> wrote:
: > Hi
: >
: > I want to find out the intersection of two hits objects  please help me
: >
: > Hits hits1 = Searcher.searh(strQuery1);
: > Hits hits2 = Searcher.searh(strQuery2);
: >
: > Now In hits1 contains records numbers 3,4 ,5,6 and
: >        Hits2 contains records numbers 3,6,8,9
: >
: > Now I need a solution which can give the hits object which contains  3,6
: > records
: >
:
: You can iterate through the Hits objects, flagging the document
: numbers in a java.util.BitSet. To compare hits between different
: queries, all you have to do is bitset1.and(bitset2).
:
: --
: Dave Kor, Research Assistant
: Center for Information Mining and Extraction
: School of Computing
: National University of Singapore.
:
: ---------------------------------------------------------------------
: To unsubscribe, e-mail: [EMAIL PROTECTED]
: For additional commands, e-mail: [EMAIL PROTECTED]
:
:
: ---------------------------------------------------------------------
: To unsubscribe, e-mail: [EMAIL PROTECTED]
: For additional commands, e-mail: [EMAIL PROTECTED]
:



-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to