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 padmanabhan <pa...@gmail.com> on 2017/08/02 13:55:24 UTC

Custom Sort option to apply at SOLR index

Hello Solr Geeks,

Am newbie to SOLR. I have a requirement as given below, Could any one please
provide some insights on how to go about on this. 

"Ascending by name" (#, 0 - 9, A - Z)

"Descending by name" (Z - A, 9 - 0, #)

Sample name value can be 

ABCD5678
1234ABCD
#2345ABCD
#1234ABCD
5678ABCD
#2345ACBD
5678EFGH
#2345DBCA
ABCD1234
1234#ABCD

*Expected Ascending order*

#2345ABCD
#2345ACBD
#2345DBCA
1234#ABCD
1234ABCD
5678ABCD
ABCD1234
ABCD5678

*Expected Descending order*

ABCD5678
ABCD1234
5678ABCD
1234ABCD
1234#ABCD
#2345DBCA
#2345ACBD
#2345ABCD

Thanks & Regards,
Paddy



--
View this message in context: http://lucene.472066.n3.nabble.com/Custom-Sort-option-to-apply-at-SOLR-index-tp4348787.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Custom Sort option to apply at SOLR index

Posted by padmanabhan <pa...@gmail.com>.
Thank you Erick, it worked.



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: Custom Sort option to apply at SOLR index

Posted by Erick Erickson <er...@gmail.com>.
I guess I don't see the problem, just store it as a string and sort on
the field.

# sorts before numbers which sort before characters. Or I'm reading
the ASCII chart wrong.

Best,
Erick

On Wed, Aug 2, 2017 at 6:55 AM, padmanabhan
<pa...@gmail.com> wrote:
> Hello Solr Geeks,
>
> Am newbie to SOLR. I have a requirement as given below, Could any one please
> provide some insights on how to go about on this.
>
> "Ascending by name" (#, 0 - 9, A - Z)
>
> "Descending by name" (Z - A, 9 - 0, #)
>
> Sample name value can be
>
> ABCD5678
> 1234ABCD
> #2345ABCD
> #1234ABCD
> 5678ABCD
> #2345ACBD
> 5678EFGH
> #2345DBCA
> ABCD1234
> 1234#ABCD
>
> *Expected Ascending order*
>
> #2345ABCD
> #2345ACBD
> #2345DBCA
> 1234#ABCD
> 1234ABCD
> 5678ABCD
> ABCD1234
> ABCD5678
>
> *Expected Descending order*
>
> ABCD5678
> ABCD1234
> 5678ABCD
> 1234ABCD
> 1234#ABCD
> #2345DBCA
> #2345ACBD
> #2345ABCD
>
> Thanks & Regards,
> Paddy
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Custom-Sort-option-to-apply-at-SOLR-index-tp4348787.html
> Sent from the Solr - User mailing list archive at Nabble.com.