You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Peter Kirk <pk...@alpha-solutions.dk> on 2012/08/16 14:00:02 UTC

Sort on dynamic field

Hi, a question about sorting and dynamic fields in "Solr Specification Version: 3.6.0.2012.04.06.11.34.07".

I have a field defined like
<dynamicField name="*_int"  type="int"  indexed="true"  stored="true" multiValued="false"/>

Where type int is
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>

If I perform a search, which returns 13 documents, and sort by a field called "item_group_int", then it almost produces the results I expect. The only thing I don't expect is that one document in the results, which does not have a field called "item_group_int", appears in the sort order as number 2. 

I think this has something to do with the fact that one of the other documents has a value of 0 for this field - it comes first in the sort.

How do I relegate documents which do not possess the requested sort-field to the last positions in the results?

Thanks,
Peter





RE: Sort on dynamic field

Posted by Peter Kirk <pk...@alpha-solutions.dk>.
On Thu, Aug 16, 2012 at 8:00 AM, Peter Kirk <pk...@alpha-solutions.dk> wrote:
>> Hi, a question about sorting and dynamic fields in "Solr Specification Version: 3.6.0.2012.04.06.11.34.07".
>>
>> I have a field defined like
>> <dynamicField name="*_int"  type="int"  indexed="true"  stored="true" multiValued="false"/>
>>
>> Where type int is
>> <fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
>
> Try adding sortMissingLast="true" to this type.

Thanks!


Re: Sort on dynamic field

Posted by Yonik Seeley <yo...@lucidworks.com>.
On Thu, Aug 16, 2012 at 8:00 AM, Peter Kirk <pk...@alpha-solutions.dk> wrote:
> Hi, a question about sorting and dynamic fields in "Solr Specification Version: 3.6.0.2012.04.06.11.34.07".
>
> I have a field defined like
> <dynamicField name="*_int"  type="int"  indexed="true"  stored="true" multiValued="false"/>
>
> Where type int is
> <fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>

Try adding sortMissingLast="true" to this type.

-Yonik
http://lucidworks.com