Erm.. I have to be missing something here, wouldn't you be able just do the following:

do a search on "Term 1" AND "Term 2"
do a search on "Term 2" AND "Term2" AND "Term 3"

This would ensure that you have two objects back, one of which is guaranteed to be a subset of the other.

Then, when you are iterating on your documents to do your highlighting over the results from the first search (At least I think that's what you are doing here) check to see if the current document exists in the hits or topDocs object that came from the second search. If it does, use the three term highlighter, if it doesn't use the two term highlighter.

But, what sort of reordering are you trying to do here anyhow?

Doing just a normal search against "Term 1" OR "Term 2" OR "Term 3" with a standard highlighter would most likely get you ... well exactly the same results as what you are describing. The only real difference I could see is the order that the documents are returned to you.

Matt

Max Lynch wrote:
Hi,
I am doing a search on my index for a query like this:

query = "\"Term 1\" \"Term 2\" \"Term 3\""

Where I want to find Term 1, Term 2 and Term 3 in the index.  However, I
only want to search for "Term 3" if I find "Term 1" and "Term 2" first, to
avoid doing processing on hits that only contain "Term 3".  To do this, I
was thinking of doing a search for "\"Term 1\" \"Term 2\"" and then if there
are hits for these terms, I would do another search for "Term 3" on these
resulting documents.  I am running a background search so I am not too
worried performance issues caused by searching twice.

Is there a way to search on subset of documents and then combining the hits
for the document?  For example, if Term 1 and Term 2 are found in Document1,
and Term3 is also later found in Document1, I want to be able to process the
hits on my highlighter as containing all three terms.

Sorry if it's confusing.

Thanks,
Max



--
Matthew Hall
Software Engineer
Mouse Genome Informatics
mh...@informatics.jax.org
(207) 288-6012



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

Reply via email to