lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob Staveley (Tom)" <rstave...@seseit.com>
Subject RE: Missing fields used for a sort
Date Tue, 11 Jul 2006 16:57:20 GMT
Thanks for the info both of you. Of course Lucene obeys Murphy's law that
the missing ones appear first when you reverse sort, which is what Murphy's
law says you want to do. 

Does solr have a custom build of Lucene in it, or is the functionality
required to required to get the missing ones to the end of the list
something that can be configured anyhow in Lucene?

-----Original Message-----
From: Yonik Seeley [mailto:yseeley@gmail.com] 
Sent: 11 July 2006 15:37
To: java-user@lucene.apache.org
Subject: Re: Missing fields used for a sort

On 7/11/06, Erick Erickson <erickerickson@gmail.com> wrote:
> So I guess all the documents without a particular field all get defaulted
> for you. Which end of the list they get placed at I guess you'll find out
> <G>...

For lucene, it depends on what direction you are sorting.

Solr gives control over this in it's schema... here are some snippets
from the example schema.xml:

    <!-- The optional sortMissingLast and sortMissingFirst attributes are
         currently supported on types that are sorted internally as a
strings.
       - If sortMissingLast="true" then a sort on this field will
cause documents
       without the field to come after documents with the field,
       regardless of the requested sort order (asc or desc).
       - If sortMissingFirst="true" then a sort on this field will
cause documents
       without the field to come before documents with the field,
       regardless of the requested sort order.
       - If sortMissingLast="false" and sortMissingFirst="false" (the
default),
       then default lucene sorting will be used which places docs
without the field
       first in an ascending sort and last in a descending sort.
    -->

    <!-- Numeric field types that manipulate the value into
         a string value that isn't human readable in it's internal form,
         but with a lexicographic ordering the same as the numeric ordering
         so that range queries correctly work. -->
    <fieldtype name="sint" class="solr.SortableIntField"
sortMissingLast="true"/>
    <fieldtype name="slong" class="solr.SortableLongField"
sortMissingLast="true"/>
    <fieldtype name="sfloat" class="solr.SortableFloatField"
sortMissingLast="true"/>
    <fieldtype name="sdouble" class="solr.SortableDoubleField"
sortMissingLast="true"/>


-Yonik
http://incubator.apache.org/solr Solr, the open-source Lucene search server

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message