lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shah, Vineel" <>
Subject RE: custom scoring api questions
Date Thu, 02 Jan 2003 16:08:45 GMT
I tried this out and it works perfectly. I'm loving Lucene! Thanks Doug!

-----Original Message-----
From: Doug Cutting []
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.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message