I want to Sort string fields in Solr as case insensitive manner.
The search results are displayed as oracle sort manner, ie it first takes any special characters, numbers, upper case (AZ) then lower case (az).
The results should be special characters, numbers, upper case (A), lowercase (a) – through uppercase (Z) lowercase(z)
Current Expected
110000 110000
ATest ATest
Btest aTest
Ctest BTest
Ztest bTest
aTest CTest
bTest cTest
cTest ZTest
Please help in configuring string field to Sort in Expected manner.
One way to achieve this would be for you to store the lower-case version of the text in a separate Solr string field when you ingest the data (eg code_for_sorting_s
) and then sort by that field.
Another way to get there would be to define a copy-field
in Solr that automatically copies the value in your current field (eg code_s
) to a new field that uses the Lower Case Filter . Using the built-in types in Solr your copy-field
definition could look more or less like this:
curl -X POST -H 'Content-type:application/json' --data-binary '{
"add-copy-field":{
"source":"code_s",
"dest":[ "code_s_lower" ]}
}' http://your-solr-core-url/schema
In this case the value of the code_s
field will be copied to a new field ( code_s_lower
). The *_s_lower
suffix is defined in Solr to create a string field that uses the Lower Case Filter that I alluded to.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.