lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From SOME ONE <sum...@yahoo.com>
Subject Re: Custom Sorting
Date Sat, 18 Feb 2006 15:18:02 GMT
Hi,

Well, I gave more thought to your suggestion and came
to the conclusion that I can not even run 2 searches.
The reason being, as I mentioned in my first message,
I am using MultiFieldQueryParser to search title and
body fields. Search terms can be found anywhere,
either in title or body or both, so I can not just run
2 searches, one with only the title criteria and then
another with only the body criteria.
By a "title match" I actually meant "at least one
search term finds a match in title", the rest of the
terms must also be found somewhere (I use AND operator
by default), and by a "body match" I meant "no term
got a match in title", so all the terms are found in
body only. I think I better re-explain my question:

I am using MultiFieldQueryParser (Lucene 1.9) to
search title and body fields in the documents. The
requirement is that documents with title match (at
least one search term finds a match in title) should
be returned before the documents with just body match
(no term got a match in title, all found in body
only). I use AND operator by default, so all the terms
must be found somewhere.

Using the default scoring, title matches do come
before the just body matches. But, I also need the
documents with title matches sorted by date, and
documents with just body matches sorted by date. i.e
there will be two groups of docs in the results, one
with title match and the other with just body match,
the first group of docs should come before the second
group, and each group should be sorted by date.

I am not concerned with the Lucene scoring as the
documents are very short. So, I think, just two scores
as described above for the two groups of docs would be
sufficient?

BTW, all the terms present in title are always present
in body as well.

Really appreciate your interest and help, any more
suggestions how to achieve the desired behaviour
please?

Thanks and Regards
Wiseman


--- "Michael D. Curtin" <mike@curtin.com> wrote:

> SOME ONE wrote:
> 
> > Yes, I could run two searches, but that means
> running
> > two searches for each request from user and that I
> > think doubles the job taking double time. Any
> > suggestions to do it more efficiently please ?
> 
> I think it would only take double time if the sets
> of hit documents have 
> substantial overlap, i.e. most of the documents meet
> both sets of criteria. 
> If the sets of documents are mainly disjoint, the
> time wouldn't matter much 
> (since the same index data structures have to be
> traversed either way).
> 
> --MDC
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail:
> java-user-help@lucene.apache.org
> 
> 


Send instant messages to your online friends http://uk.messenger.yahoo.com 

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