You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Shah, Vineel" <vi...@hotjobs.com> on 2003/01/02 17:08:45 UTC

RE: custom scoring api questions

I tried this out and it works perfectly. I'm loving Lucene! Thanks Doug!

-----Original Message-----
From: Doug Cutting [mailto:cutting@lucene.com]
Sent: Tuesday, December 31, 2002 12:40 PM
To: Lucene Developers List
Subject: Re: custom scoring api questions


Shah, Vineel wrote:
> Here's what I'm trying to do:
> A query that looks for for "java unix windows" in the "keywords" field of an index.
> 
> If the document has "java unix", the score is .66..., regardless of any other factor. I want 1.0 for all three, .33... for just one, and no hit for none.

This is easy to do with the Similarity API.  Just define all of the 
methods to return 1.0, except queryNorm(), which, for your purposes, 
should return the inverse of the value passed.

I've attached a demonstration that implements the scoring you desire.

Doug