lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From - Roman Baeriswyl <>
Subject Sorting and Empty (non-existing) Fields
Date Tue, 18 May 2010 16:18:34 GMT
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

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

Can anyone give me some hints?


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:

View raw message