Implement custom score

2004-09-22 Thread [EMAIL PROTECTED]
Hi, I know this is probably a common question and I've found a couple of posts about it in the archive but none with a complete answer. If there is one please point me to it! The question is that I want to discard the default scoring and implement my own. I want all the the hits to be sorted

Re: Implement custom score

2004-09-22 Thread Otis Gospodnetic
You need your own Similarity implementation and you need to set it as shown in this javadoc: http://jakarta.apache.org/lucene/docs/api/org/apache/lucene/search/Similarity.html Otis --- [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I know this is probably a common question and I've found a

Re: Implement custom score

2004-09-22 Thread [EMAIL PROTECTED]
Yes thanks, I implemented my own Similarity class that returns 1.0f from lengthNorm() and idf() then I use setBoost when writing the document. However I get some small round errors. When I boost with 0.7 that document gets the score 0.625. I've found that this has to do with the encode/decode norm

Re: Implement custom score

2004-09-22 Thread Erik Hatcher
Actually what William should use is the new Sort facility to order results by a field. Doing this with a Similarity would be much trickier. Look at the IndexSearcher.sort() methods which take a Sort and follow the Javadocs from there. Let us know if you have any questions on sorting.

Re: Implement custom score

2004-09-22 Thread [EMAIL PROTECTED]
Thanks for the reply, I've looked in to the search method that takes a Sort object as argument. As I understand it the sorting is only done on the best matches (100 by default)? I don't want the default score to have any impact at all. I want to sort all hits on popularity not just the best

Re: Implement custom score

2004-09-22 Thread Erik Hatcher
Sorting is done however you specify, by field, with secondary fields specified, by document id, by score/relevance, or even by a custom implementation to sort by something else (in Lucene in Action we provide an implementation that sorts by two-dimensional distance from a given location,