lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Reetha Hariharan" <>
Subject Re: Newbie Question - Lucene Sorting NOT Ignoring NULL values
Date Tue, 14 Oct 2008 16:55:11 GMT
Hi Yonik,

Thanks for your reply.

In my case I don't want those document that has Null value for the field
that I am willing to sort

I tried writing my own filter using RangeFilter, but it doesn't work.

I used something like the following in my custom filter.

public class NotNullRangeFilter extends {
    private RangeFilter rangeFilter;
    public BitSet bits(IndexReader reader) throws IOException {
        rangeFilter = RangeFilter.More("lastUpdatedDate"/*Field to sort*/,
"" /*atleast an empty string but not null*/);
        return rangeFilter.bits(reader);

The above does not work. Let me know if I am doing something wrong.

Any inputs on this ?


On Tue, Oct 14, 2008 at 8:11 AM, Yonik Seeley <> wrote:

> On Tue, Oct 14, 2008 at 4:35 AM, Reetha Hariharan <>
> wrote:
> > I am searching using one field, say X and want to sort the results using
> > another, say Y (Which can have null values). But I am expecting Sort to
> > ignore all the null values and just sort only records that has values in
> Y
> > field.
> Do you want docs with null (missing) values in the results or not?
> If so, they need to go somewhere (before or after the others).
> If you don't want those docs at all, exclude them in the query, or
> with a filter.
> -Yonik
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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