: If i rememebr correctly (you'll have to test this) sorting on a field
: which doesn't exist for every doc does what you would want (docs with
: values are listed before docs without)

: The actual behavior is different than described above. I modified
: TestSort.java:

: The actual order of the results is: "ZJI". I believe this happens because
: the field string cache 'order' array contains 0's for all the documents that
: don't contain the field and thus sort first.

i guess wasn't precise enough in that old thread, what i ment was that not
having a vlaue results in the docs sorting the same as if they had a value
lower then the lowest existing value -- so they sort at the end of the
list if you are doing a descending sort, and at the begining of the list
if you do an ascending sort.  If you want to always have them come "last"
regardless of order, there is a SortComparator for that purpose in Solr...

https://issues.apache.org/jira/browse/LUCENE-406
http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/search/MissingStringLastComparatorSource.java?view=log

: Suppose I want to exclude documents from being collected if they don't
: contain the sort field. One way to do this is to index a unique
: 'empty_value' value for those documents and add a MUST_NOT boolean clause to
: the query, for example: "<query terms> -field:empty_value)". But this seems
: inefficient. Is there a better way?

excluding them completely is a slightly differnet task, you don't need to
index a special marker value, you can just use a
RangeFilter (or ConstantScoreRangeQuery) to ensure you only get docs with
a value for that field (ie: field:[* TO *])



-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to