String types do no analysis whatsoever. Therefore case matters, All upper case sorts before all lower case. Punctuation matters. Spaces matter etc.
What people often do is create a special field for sorting and normalize it by folding case etc. Usually you have to do this on the input. You might also be able to use a KeywordTokenizer to produce sortable tokens on text fields that would allow you to put the normalization into your schema instead. Look for "alphaonlysort" in some of the example schemas for a model. Best, Erick On Mon, Aug 21, 2017 at 3:52 AM, amukherjee10 <amukherje...@sapient.com> wrote: > I am passing a Solr query to fetch few results. Im trying to sort the data > based on field of "string" type - documenttitle_s. Below is the full query > that is getting passed: > http://localhost:8000/solr/web/select?q=**&qt=/standard&qf=documenttitle_t+documentproductname_s+documenttypetext_s+mediacontent_t&start=0&fq=(_latestversion:true)&fq=(_template:f2909e5b58954a53affe8360b275a739)&facet.mincount=0&sort=documenttitle_s+desc&rows=50&facet=true&version=2.2 > > The issue is that, though most of the data is getting sorted, few results > are causing some anomaly. For example: text1 = onRisks - The variable > affecting choices in the 21st century, text2 = onRisks - Econs, Humans and > the Perception, text3 = Witch Redemption Authorization, text4 = Walk > Infographic - Rising > Ideally text3 should come on top when sorted in desc manner, but text1 is > coming on top. > > Can anyone tell me what is going wrong here? > > > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Solr-sort-incorrectly-tp4351419.html > Sent from the Solr - User mailing list archive at Nabble.com.