lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Bygrave <>
Subject Re: Sorting and Empty (non-existing) Fields
Date Wed, 19 May 2010 00:07:19 GMT
BTW:  Saw this in the SOLR docs...

       - If sortMissingLast="false" and sortMissingFirst="false" (the
*         then default lucene sorting will be used which places docs without
         field first in an ascending sort and last in a descending sort.*

On Wed, May 19, 2010 at 4:18 AM, - Roman Baeriswyl <> wrote:

> Hi All
> I've got a problem I'm trying to solve the whole day:
> Let's say I have an index with two fields, the first one is always filled
> and the second one only sometimes.
> Now I want to search something on the first field and want the results
> sorted by relevance, then by the first field, then by the second field.
> My problem now is that, if I have a lot of Entries with the same value in
> the first field and no value in the second field, these entries with no
> value on the 2nd field are coming first.
> Is there any way to increase the score on those documents which have a
> value on the second field? Or is there any way to skip those Documents which
> don't have the second field? I don't want to use a Filter, it should all be
> done with the Queries Objects if possible.
> I tried a lot of things with WildcardQuery or TermRangeQuery (with null
> values or empty strings) in Luke and directly in IndexSearcher, but I always
> get either no results or all results, even those which have no value in the
> second field.
> I found a lot of information where "-field2:[* TO *]" or similar stuff
> should work but it doesn't.
> Can anyone give me some hints?
> Thanks
> Roman
> Holen Sie die besten Elektronik-Aktionen direkt auf Ihr Facebook-Profil:
> Die besten Elektronik-Aktionen auf Twitter:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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