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 Mike <mp...@comcast.net> on 2009/11/20 17:08:24 UTC
Default sort order for filter query
When I do a search using q=*:* and then narrow down the result set using
a filter query, are there rules that are used for the sort order in the
result set? In my results I have a "name" field that appears to be
sorted descending in lexicographical order. For example:
<doc><str name="name">Wyoming</str></doc>
<doc><str name="name">Wynford</str></doc>
<doc><str name="name">Wrightstown</str></doc>
The field declaration is:
<field name="name" type="text" indexed="true" stored="true"> and this is
the first field that is defined that is of type text. I'm assuming the
ordering is arbitrary. I can easily setup a new field for sorting based
on the "string" type, but I'm curious what rules are deciding the sort
order in this example.
I'm using the dismax and the 1.4 release.
Mike
Re: Default sort order for filter query
Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Fri, Nov 20, 2009 at 11:28 AM, Yonik Seeley
<yo...@lucidimagination.com> wrote:
> On Fri, Nov 20, 2009 at 11:15 AM, Mike <mp...@comcast.net> wrote:
>> Sorry for the noise - I think I have just answered my own question. The
>> order in which docs are indexed determine the result sort order unless
>> overridden via sort query parameters :)
>
> Correct.
I should clarify - I meant "Correct" in that the sort order you are
seeing is by internal docid, not that it's the default sort.
The default sort is always by score... it's just that *:* is producing
the same score for all docs, thus the sort you see is the tiebreaker
(internal document id).
-Yonik
http://www.lucidimagination.com
Re: Default sort order for filter query
Posted by Mike <mp...@comcast.net>.
Yonik Seeley wrote:
> On Fri, Nov 20, 2009 at 11:15 AM, Mike <mp...@comcast.net> wrote:
>
>> Sorry for the noise - I think I have just answered my own question. The
>> order in which docs are indexed determine the result sort order unless
>> overridden via sort query parameters :)
>>
>
> Correct. The internal lucene document id is the tiebreaker for all sorts.
>
> -Yonik
> http://www.lucidimagination.com
>
>
>
Good to know and makes things more clear. Thanks.
Re: Default sort order for filter query
Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Fri, Nov 20, 2009 at 11:15 AM, Mike <mp...@comcast.net> wrote:
> Sorry for the noise - I think I have just answered my own question. The
> order in which docs are indexed determine the result sort order unless
> overridden via sort query parameters :)
Correct. The internal lucene document id is the tiebreaker for all sorts.
-Yonik
http://www.lucidimagination.com
Re: Default sort order for filter query
Posted by Mike <mp...@comcast.net>.
Mike wrote:
> When I do a search using q=*:* and then narrow down the result set
> using a filter query, are there rules that are used for the sort order
> in the result set? In my results I have a "name" field that appears to
> be sorted descending in lexicographical order. For example:
>
> <doc><str name="name">Wyoming</str></doc>
> <doc><str name="name">Wynford</str></doc>
> <doc><str name="name">Wrightstown</str></doc>
>
> The field declaration is:
>
> <field name="name" type="text" indexed="true" stored="true"> and this
> is the first field that is defined that is of type text. I'm assuming
> the ordering is arbitrary. I can easily setup a new field for sorting
> based on the "string" type, but I'm curious what rules are deciding
> the sort order in this example.
>
> I'm using the dismax and the 1.4 release.
>
> Mike
>
>
>
>
>
Sorry for the noise - I think I have just answered my own question. The
order in which docs are indexed determine the result sort order unless
overridden via sort query parameters :)