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 <[EMAIL PROTECTED]> : 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: [EMAIL PROTECTED] : For additional commands, e-mail: [EMAIL PROTECTED] : -Hoss --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]