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 umaswayam <um...@gmail.com> on 2012/01/04 14:40:17 UTC

Query regarding solr custom sort order

Hi,

We want to sort our records based on some sequence which is like
1 2 3 4 5 6 7 8 9  10 11 12 13 14.....

I am using Websphere commerce to retrieve data using solr. When we are
customizing the sort order/ option in wc-search.xml file then we are getting
the sort order as
1 10 11 12 13 14 2 3 4 5 6 7 8 9 like this.

As I guess the sort order is checking with first digit of all sequences &
based on that if they are same moving on to compare the next digit & so on,
which is resulting on wrong sort output.

Can anyone put some thoughts on this or help me out if I am doing something
wrong here.

Thanks in advance
Uma Shankar



--
View this message in context: http://lucene.472066.n3.nabble.com/Query-regarding-solr-custom-sort-order-tp3631854p3631854.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Query regarding solr custom sort order

Posted by umaswayam <um...@gmail.com>.
Hi,

Let me clarify the situation here in details.

The default sort which Websphere commerce provide is based on name & price
of any item. but we are having unique values of every item. hence sorting
goes on fine either as intger or as string but while preprocess we generate
some temporary tables like TI_CATGPENREL_0, where sequence number is
multiple value for a particular catentry id(item). this field (sequence) is
declared as varchar because it can contain multiple values separated by ";"
which solr returns, hence sorting based on sequence will happen
lexicographically as discussed in the thread. So can we restrict it to send
single values based on certain category ID or something like this.

Thanks in advance,
Uma Shankar 

--
View this message in context: http://lucene.472066.n3.nabble.com/Query-regarding-solr-custom-sort-order-tp3631854p3665545.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Query regarding solr custom sort order

Posted by Bernd Fehling <be...@uni-bielefeld.de>.
Hi Uma,

i don't understand what you're looking for.

Do you need to sort on fields of type double with precision 2 or what?

In your example you were talking about
1 2 3 4 5 6 7 8 9  10 11 12 13 14.....

Regards,
Bernd


Am 06.01.2012 07:11, schrieb umaswayam:
> Hi Bernd,
>
> The column which comes from database is string only,&  that is being default
> populated. How do I convert it to double as the format is 1.00,2.00,3.00 in
> database. So I need it to be coverted to double only.
>
> Thanks,
> Uma Shankar
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Query-regarding-solr-custom-sort-order-tp3631854p3637181.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Re: Query regarding solr custom sort order

Posted by umaswayam <um...@gmail.com>.
Hi Bernd,

The column which comes from database is string only, & that is being default
populated. How do I convert it to double as the format is 1.00,2.00,3.00 in
database. So I need it to be coverted to double only.

Thanks,
Uma Shankar

--
View this message in context: http://lucene.472066.n3.nabble.com/Query-regarding-solr-custom-sort-order-tp3631854p3637181.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Query regarding solr custom sort order

Posted by Bernd Fehling <be...@uni-bielefeld.de>.
Hi,

I suggest using the following fieldType for your field:

<fieldType name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="true"/>

Regards
Bernd

Am 04.01.2012 14:40, schrieb umaswayam:
> Hi,
>
> We want to sort our records based on some sequence which is like
> 1 2 3 4 5 6 7 8 9  10 11 12 13 14.....
>
> I am using Websphere commerce to retrieve data using solr. When we are
> customizing the sort order/ option in wc-search.xml file then we are getting
> the sort order as
> 1 10 11 12 13 14 2 3 4 5 6 7 8 9 like this.
>
> As I guess the sort order is checking with first digit of all sequences&
> based on that if they are same moving on to compare the next digit&  so on,
> which is resulting on wrong sort output.
>
> Can anyone put some thoughts on this or help me out if I am doing something
> wrong here.
>
> Thanks in advance
> Uma Shankar
>


Re: Query regarding solr custom sort order

Posted by Erik Hatcher <er...@gmail.com>.
You're using a string field type, I imagine.  Use a numeric field type instead.

wc-search.xml?   That's not a solr config file; must be something specific to your app.

	Erik

On Jan 4, 2012, at 08:40 , umaswayam wrote:

> Hi,
> 
> We want to sort our records based on some sequence which is like
> 1 2 3 4 5 6 7 8 9  10 11 12 13 14.....
> 
> I am using Websphere commerce to retrieve data using solr. When we are
> customizing the sort order/ option in wc-search.xml file then we are getting
> the sort order as
> 1 10 11 12 13 14 2 3 4 5 6 7 8 9 like this.
> 
> As I guess the sort order is checking with first digit of all sequences &
> based on that if they are same moving on to compare the next digit & so on,
> which is resulting on wrong sort output.
> 
> Can anyone put some thoughts on this or help me out if I am doing something
> wrong here.
> 
> Thanks in advance
> Uma Shankar
> 
> 
> 
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Query-regarding-solr-custom-sort-order-tp3631854p3631854.html
> Sent from the Solr - User mailing list archive at Nabble.com.


Re: Query regarding solr custom sort order

Posted by "Sethi, Parampreet" <pa...@teamaol.com>.
Hi Uma,

Have you declared the type as integer for this field? In case, type is
some form of String (text, string etc.) the sorting will happen
lexicographically.

-param

On 1/4/12 8:40 AM, "umaswayam" <um...@gmail.com> wrote:

>Hi,
>
>We want to sort our records based on some sequence which is like
>1 2 3 4 5 6 7 8 9  10 11 12 13 14.....
>
>I am using Websphere commerce to retrieve data using solr. When we are
>customizing the sort order/ option in wc-search.xml file then we are
>getting
>the sort order as
>1 10 11 12 13 14 2 3 4 5 6 7 8 9 like this.
>
>As I guess the sort order is checking with first digit of all sequences &
>based on that if they are same moving on to compare the next digit & so
>on,
>which is resulting on wrong sort output.
>
>Can anyone put some thoughts on this or help me out if I am doing
>something
>wrong here.
>
>Thanks in advance
>Uma Shankar
>
>
>
>--
>View this message in context:
>http://lucene.472066.n3.nabble.com/Query-regarding-solr-custom-sort-order-
>tp3631854p3631854.html
>Sent from the Solr - User mailing list archive at Nabble.com.