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 Mysurf Mail <st...@gmail.com> on 2013/08/06 16:06:14 UTC
Multiple sorting does not work as expected
My documents has 2 indexed attribute - name (string) and version (number)
I want within the same score the documents will be displayed by the
following order
score(desc),name(desc),version(desc)
Therefor I query using :
http://localhost:8983/solr/vault/select?
q=BOM&fl=*:score&
sort=score+desc,Name+desc,Version+desc
And I get the following inside the result:
<doc>
<str name="Name">BOM Total test2</str>
...
<int name="Version">2</int>
...
<float name="score">2.2388418</float>
</doc>
<doc>
<str name="Name">BOM Total test - Copy</str>
...
<int name="Version">2</int>
...
<float name="score">2.2388418</float>
</doc>
<doc>
<str name="Name">BOM Total test2</str>
...
<int name="Version">1</int>
...
<float name="score">2.2388418</float>
</doc>
The scoring is equal, but the name is not sorted.
What am I doing wrong here?
Re: Multiple sorting does not work as expected
Posted by Erick Erickson <er...@gmail.com>.
Well, at least it's not throwing an error <G>.
Sorting on a tokenized field is not supported,
or rather the behavior is undefined. Your Name
field is tokenized if it's the stock text_en field.
Best
Erick
On Tue, Aug 6, 2013 at 11:03 AM, Mysurf Mail <st...@gmail.com> wrote:
> I don't see how it is sorted.
> this is the order as displayed above
>
> 1-> BOM Total test2
> 2-> BOM Total test - Copy
> 3-> BOM Total test2
>
> all in the same 2.2388418 score
>
>
> On Tue, Aug 6, 2013 at 5:28 PM, Jack Krupansky <jack@basetechnology.com
> >wrote:
>
> > The Name field is sorted as you have requested - "desc". I suspect that
> > you wanted name to be sorted "asc" (natural order.)
> >
> > -- Jack Krupansky
> >
> > -----Original Message----- From: Mysurf Mail
> > Sent: Tuesday, August 06, 2013 10:22 AM
> > To: solr-user@lucene.apache.org
> > Subject: Re: Multiple sorting does not work as expected
> >
> >
> > my schema
> >
> > ....
> > <field name="Name" type="text_en" indexed="true" stored="true"
> > required="true"/>
> > <field name="Version" type="int" indexed="true" stored="true"
> > required="true"/>
> > ....
> >
> >
> >
> > On Tue, Aug 6, 2013 at 5:06 PM, Mysurf Mail <st...@gmail.com>
> wrote:
> >
> > My documents has 2 indexed attribute - name (string) and version
> (number)
> >> I want within the same score the documents will be displayed by the
> >> following order
> >>
> >> score(desc),name(desc),**version(desc)
> >>
> >> Therefor I query using :
> >>
> >> http://localhost:8983/solr/**vault/select<
> http://localhost:8983/solr/vault/select>
> >> ?
> >> q=BOM&fl=*:score&
> >> sort=score+desc,Name+desc,**Version+desc
> >>
> >> And I get the following inside the result:
> >>
> >> <doc>
> >> <str name="Name">BOM Total test2</str>
> >> ...
> >> <int name="Version">2</int>
> >> ...
> >> <float name="score">2.2388418</float>
> >> </doc>
> >> <doc>
> >> <str name="Name">BOM Total test - Copy</str>
> >> ...
> >> <int name="Version">2</int>
> >> ...
> >> <float name="score">2.2388418</float>
> >> </doc>
> >> <doc>
> >> <str name="Name">BOM Total test2</str>
> >> ...
> >> <int name="Version">1</int>
> >> ...
> >> <float name="score">2.2388418</float>
> >> </doc>
> >>
> >> The scoring is equal, but the name is not sorted.
> >>
> >> What am I doing wrong here?
> >>
> >>
> >
>
Re: Multiple sorting does not work as expected
Posted by Mysurf Mail <st...@gmail.com>.
I don't see how it is sorted.
this is the order as displayed above
1-> BOM Total test2
2-> BOM Total test - Copy
3-> BOM Total test2
all in the same 2.2388418 score
On Tue, Aug 6, 2013 at 5:28 PM, Jack Krupansky <ja...@basetechnology.com>wrote:
> The Name field is sorted as you have requested - "desc". I suspect that
> you wanted name to be sorted "asc" (natural order.)
>
> -- Jack Krupansky
>
> -----Original Message----- From: Mysurf Mail
> Sent: Tuesday, August 06, 2013 10:22 AM
> To: solr-user@lucene.apache.org
> Subject: Re: Multiple sorting does not work as expected
>
>
> my schema
>
> ....
> <field name="Name" type="text_en" indexed="true" stored="true"
> required="true"/>
> <field name="Version" type="int" indexed="true" stored="true"
> required="true"/>
> ....
>
>
>
> On Tue, Aug 6, 2013 at 5:06 PM, Mysurf Mail <st...@gmail.com> wrote:
>
> My documents has 2 indexed attribute - name (string) and version (number)
>> I want within the same score the documents will be displayed by the
>> following order
>>
>> score(desc),name(desc),**version(desc)
>>
>> Therefor I query using :
>>
>> http://localhost:8983/solr/**vault/select<http://localhost:8983/solr/vault/select>
>> ?
>> q=BOM&fl=*:score&
>> sort=score+desc,Name+desc,**Version+desc
>>
>> And I get the following inside the result:
>>
>> <doc>
>> <str name="Name">BOM Total test2</str>
>> ...
>> <int name="Version">2</int>
>> ...
>> <float name="score">2.2388418</float>
>> </doc>
>> <doc>
>> <str name="Name">BOM Total test - Copy</str>
>> ...
>> <int name="Version">2</int>
>> ...
>> <float name="score">2.2388418</float>
>> </doc>
>> <doc>
>> <str name="Name">BOM Total test2</str>
>> ...
>> <int name="Version">1</int>
>> ...
>> <float name="score">2.2388418</float>
>> </doc>
>>
>> The scoring is equal, but the name is not sorted.
>>
>> What am I doing wrong here?
>>
>>
>
Re: Multiple sorting does not work as expected
Posted by Jack Krupansky <ja...@basetechnology.com>.
The Name field is sorted as you have requested - "desc". I suspect that you
wanted name to be sorted "asc" (natural order.)
-- Jack Krupansky
-----Original Message-----
From: Mysurf Mail
Sent: Tuesday, August 06, 2013 10:22 AM
To: solr-user@lucene.apache.org
Subject: Re: Multiple sorting does not work as expected
my schema
....
<field name="Name" type="text_en" indexed="true" stored="true"
required="true"/>
<field name="Version" type="int" indexed="true" stored="true"
required="true"/>
....
On Tue, Aug 6, 2013 at 5:06 PM, Mysurf Mail <st...@gmail.com> wrote:
> My documents has 2 indexed attribute - name (string) and version (number)
> I want within the same score the documents will be displayed by the
> following order
>
> score(desc),name(desc),version(desc)
>
> Therefor I query using :
>
> http://localhost:8983/solr/vault/select?
> q=BOM&fl=*:score&
> sort=score+desc,Name+desc,Version+desc
>
> And I get the following inside the result:
>
> <doc>
> <str name="Name">BOM Total test2</str>
> ...
> <int name="Version">2</int>
> ...
> <float name="score">2.2388418</float>
> </doc>
> <doc>
> <str name="Name">BOM Total test - Copy</str>
> ...
> <int name="Version">2</int>
> ...
> <float name="score">2.2388418</float>
> </doc>
> <doc>
> <str name="Name">BOM Total test2</str>
> ...
> <int name="Version">1</int>
> ...
> <float name="score">2.2388418</float>
> </doc>
>
> The scoring is equal, but the name is not sorted.
>
> What am I doing wrong here?
>
Re: Multiple sorting does not work as expected
Posted by Mysurf Mail <st...@gmail.com>.
my schema
....
<field name="Name" type="text_en" indexed="true" stored="true"
required="true"/>
<field name="Version" type="int" indexed="true" stored="true" required="true"/>
....
On Tue, Aug 6, 2013 at 5:06 PM, Mysurf Mail <st...@gmail.com> wrote:
> My documents has 2 indexed attribute - name (string) and version (number)
> I want within the same score the documents will be displayed by the
> following order
>
> score(desc),name(desc),version(desc)
>
> Therefor I query using :
>
> http://localhost:8983/solr/vault/select?
> q=BOM&fl=*:score&
> sort=score+desc,Name+desc,Version+desc
>
> And I get the following inside the result:
>
> <doc>
> <str name="Name">BOM Total test2</str>
> ...
> <int name="Version">2</int>
> ...
> <float name="score">2.2388418</float>
> </doc>
> <doc>
> <str name="Name">BOM Total test - Copy</str>
> ...
> <int name="Version">2</int>
> ...
> <float name="score">2.2388418</float>
> </doc>
> <doc>
> <str name="Name">BOM Total test2</str>
> ...
> <int name="Version">1</int>
> ...
> <float name="score">2.2388418</float>
> </doc>
>
> The scoring is equal, but the name is not sorted.
>
> What am I doing wrong here?
>