: 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.
first off: if your primary sort is on relevancy, there are going to be very few cases where your secondary sort comes into play -- the scoring formula generates a float, and those floats aren't likely to be identical unless the documents themselves are extremely similar. : 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 yes, add a prohibited clause to your query, which is a nested BooleanQuery containing a mandatory MatchAllDocsQuery and a prohibited full range query on field2 (ie: "-(+*:* -field2:[* TO *]" ) ... that will ensure those docs are exlcuded from your query. alternately you could make them score lower by just adding an optional clause that boosts the score of any docs that do have a value in that field (ie: "field2[* TO *]^1000" ) Lastly: if you don't want to affect the scores in any way, and you don't wnat to exclude the docs from the result set, just make them sort after other docs that do have a value in that field, you can consider using something like this... http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/search/MissingStringLastComparatorSource.java ...but note that it only works for sorting "Strings" because that's the only type of FieldCache that understands the idea of Documents that are "missing" a field. -Hoss --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org