On 11/24/21 1:08 PM, Thamizhazhagan B wrote:
When we give white space at the end, Solr gives random results. If we remove the white space at the end, returns exact matching results.
I replied to this on solr-dev, didn't notice that it was cross-posted to solr-user as well. FYI: solr-user is the correct place. It is offtopic for the dev list. Here is that reply:
I think you may have a fundamental misunderstanding of exactly what KeywordTokenizer does.
If the indexed data into that field is "This is test result" (minus the quotes) then there will be precisely one indexed term with the fieldType you shared. That term will be "this is test result" (also minus the quotes). That term will include the spaces. The only way it will match is if you include the entire text "this is test result" as the query, and there could be caveats to that depending on what Solr version you have and precisely how your query is formed. You cannot send part of it and expect a match. When you see "keyword tokenizer" what you should be thinking is "exact tokenizer". It does NOT split the input into multiple words. Which makes the use of "keyword" in the tokenizer name a little bit confusing.
Are you sending the quotes to Solr with the query, or are the quotes you typed just to show us what the query text is? It would be helpful to see EXACTLY what you are sending to Solr and the entire handler definition from solrconfig.xml. You could also include "echoParams=all" as a parameter on the query and then the response will have all parameters in the header.
What version of Solr? Have you included the "sow" parameter, either with the query or in the handler definition?
Thanks, Shawn