lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Need some Advice on Searching
Date Mon, 22 May 2006 07:09:55 GMT

: Score/Relavence is not Important. I need the Yes/No logic with the what
: caused the Match Info. Could you mayby explain the intersect/union the
: bitsets and the interogating to know
: what matched?

let's say hypothetically the logical "query" you want is "(A OR B) AND (C
OR D)"  where A, B, C, and D can all be represented as Lucene Query
objects.

that means you can say something like...

   BitSet a = (new QueryFilter(A)).bits(reader);
   BitSet b = (new QueryFilter(B)).bits(reader);
   BitSet c = (new QueryFilter(C)).bits(reader);
   BitSet d = (new QueryFilter(D)).bits(reader);

   BitSet result = c.clone().or(d).and(a.clone().or(b));

...now each set bit in result corrisponds to a document that matches your
whole "query" (the bitIndex is the doc id). and for any given set bit, you
can look at a-d to find out which of the sub queries it matched on.

(QueryFilter isn't neccessary, any filter that selects the documents you
want will work, QueryFilter is just handy for illustrating my point
easily).


-Hoss


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