lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <>
Subject Re: Boost Problem (again), need example !
Date Mon, 22 Feb 2010 09:32:34 GMT
Can't you simply sort by descending score (your score, not lucene's)?
Seems to me that would give you what you are asking for.

The setBoost() method is unlikely to work consistently because it only
infuences the score rather than setting it.  If your John Mickeal doc
happens to have a higher lucene score, because of the normal
idf/tf/etc stuff, then the setBoost() with a higher value for John
Smith may well not be enough to force John Smith to the top.

I don't know enough about function queries to help you much there but
FieldScoreQuery might work.  I can't see any sign of class
FunctionQuery in the 3.0.0 core package so am not clear what that is.


On Mon, Feb 22, 2010 at 8:54 AM, pdaures <> wrote:
> Hi,
> I know that there are many topics about scoring issues, but I didn't find an
> answer in the topics.
> This is the problem :
> Imagine I'm a teacher, and I have to index all the results, comments and
> score about students.
> Student :
> String name (eg : John Smith)
> String comments : (eg: John is a good student, but he needs to be more self
> confident bla bla bla)
> float score (eg : 98)
> I have to index all the students and when I use the search class, I want to
> get first the best students. So, if John Smith is a better student than John
> Mickael, when I search "John" I want to have John Smith BEFORE John Mickeal.
> To do that, I'm using BooleanQuery to search in name and comment fields.
> First, I thought I could use the function Document.setBoost(float boost)
> while indexing student, with boost = Student.score. But the result was not
> what I was expected, it didn't work correctly.
> Then I thought I could use a FunctionQuery to search :
> FunctionQuery functionQuery = new FunctionQuery(new
> ReverseOrdFieldSource("score"));
> But the result was still incorrect.
> I don't know what I'm doing wrong. Could you help me to find a solution ?
> Thank you :)
> --
> View this message in context:
> Sent from the Lucene - Java Users mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message