On 3/13/2016 4:58 PM, vkrishna wrote:
> I am new to solr and using 5.4 version. Everything is good up to now, but I
> am facing a problem with sorting order. When I query for some thing let's
> say for 'a', I am getting the expected results in sorting order but it is
> giving more preference to number first then space after that character. Here
> is the example result what I got when I search for 'a'.
>
> Resulted order
> ----------------
> a4apple
> a for ant
> aforapache
>
> Required order
> -----------------
> a for ant
> aforapache
> a4apple
>
> Can someone please help be how to get the result in expected sort order.

Numbers will always come before letters.  This is simply the lexical
order of the characters, and how the sorting algorithms I've used have
always worked.  I'm a little surprised that the space isn't coming
before the number, though.

It appears that Unicode sorting treats spaces different than ASCII
sorting.  Solr uses Unicode (UTF8) characters.  I found this, which
seems to support this idea:

http://unix.stackexchange.com/questions/252419/unexpected-sort-order-in-en-us-utf-8-locale

Thanks,
Shawn

Reply via email to