lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <>
Subject Re: Custom Sorting Based on Input Value
Date Tue, 14 Oct 2008 12:20:41 GMT
I don' know how tight your result must be, but here's a couple
of ideas....

1> you could boost your target by a huge amount, although forming
your query might be "interesting". If you somehow worked the clause
fieldA:5^10000 say. I suspect that some of your results wouldn't be on
top, but it might be "close enough".

2> you could do something with FieldSortedHitQueue

3> maybe you could provide a custom sorter by using
SortComparator, although you should look at the warnings
in the API.

Now I'll wait for Hoss to say "Isn't that what XXX provides" <G>...


On Mon, Oct 13, 2008 at 5:54 PM, Ravis <> wrote:

> Hi,
> I have a sorting requirement where I need to bubble up documents exactly
> matching of particular value passed in sort criteria.
> For example: Hypothetically, Say I am sorting on field A. I want all values
> matching value '5' on top and then regular sorting for other values. So I
> would like to do something like: sort by: fieldA(5).
> Any recommendation how I can achieve this using Lucene.
> thanks,
> Ravi
> --
> View this message in context:
> Sent from the Lucene - Java Users mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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