lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Enrique Lamas" <enrique.la...@corp.ya.com>
Subject Re: queryParser and sorting question
Date Tue, 25 Jul 2006 07:08:40 GMT
Thanks Chris, I'll try that.

Bye

----- Original Message ----- 
From: "Chris Hostetter" <hossman_lucene@fucit.org>
To: <java-user@lucene.apache.org>
Sent: Tuesday, July 25, 2006 3:46 AM
Subject: Re: queryParser and sorting question



1) subclass DefaultSimilarity so that tf/idf allways return either
0 or 1 (more info on this can be found in the archives).

2) sort on score, and then your specific field as a secondary sort.

Of the top of my head, that should give you what you want ... but there
may be something else about the score that you have to tweak with the
Similarity class ... Searcher.explain will help you check that you get
consistent scores in all of your potential cases.

: Date: Mon, 24 Jul 2006 15:19:32 +0200
: From: Enrique Lamas <enrique.lamas@corp.ya.com>
: Reply-To: java-user@lucene.apache.org
: To: java-user@lucene.apache.org
: Subject: queryParser and sorting question
:
: Hi,
: I'm, trying to execute a query to find some words, and I'm using
:
: QueryParser queryParser = new MultiFieldQueryParser(new String[] {"tags",
: "title"}, ProcessConstants.analyzer);
: Query query = queryParser.parse("word1 word2 word3");
:
: I want to show the results sorted like this:
:
: first, documents containing all of the three words, and this documents
: sorted by one of the index fields.
: Next, documents containing two of the words, also sorted by the same field
: like before.
: And so on.
:
: ┬┐How can I do this?
:
: I wold like to avoid executing several queries of this kind:
: "word1 + word2 + word3"
: "word1 + word2 - word3"
: "word1 - word2 + word3"
: "word1 - word2 - word3"
: .....
:
: Thanks
:
:
: ---------------------------------------------------------------------
: To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
: For additional commands, e-mail: java-user-help@lucene.apache.org
:



-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