Using Alfresco Community - 5.0.0 version.
Below query using Solr returned result :
1st Query : select cmisbjectId from TEST:doc where TEST:docType = 'Type1'
But we want the case-insensitive search if there are docType value 'type1' || 'TYPE1' || 'tYpe1' || 'Type1' then it should give same number of records.
I've tried below query which works fine while "Trying DB query DbOrIndexSwitchingQueryLanguage" fetch,
but "Using SOLR query DbOrIndexSwitchingQueryLanguage" not returning any result for the same query.
2nd Query: select cmisbjectId from TEST:doc where LOWER(TEST:docType) = 'type1'
But while using LOWER it's execution time is much higher. For example, if the 1st query takes 10ms then 2nd takes around 3 seconds.
What is the syntax to search in Solr case insensitive or is there another way to resolve this performance issue?
Have you tried "CONTAINS" clause instead of "LOWER"?
Wanna do exact string search but case-insensitive, contains will lead to wrong results.
IMO first query is giving you all required results and it's case-insensitive, but probably I'm wrong.
If you want to query for case insensitive matches, your best bet is probably using FTS query language instead of CMIS. Though bear in mind that for FTS as well can by definition not achieve both at the same time (exact + insensitive match), but for different reasons. If you don't specify exact match per query modifier, you will get case insensitive matches, but due to tokenisation and stemming you may also get matches for slightly different values (i.e. "motor" vs. "motors").
Effectively, unless you start writing custom, special purpose SQL queries without using the standardised query languages, you will likely not be able to achieve 100% of what you want.
Cross-posted here: How to Query case insensitive in Alfresco Solr search? - Stack Overflow.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.