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.
For example:
*No whitespace at end:*
Keyword : “test result”
Result: This is *Test Result*
*Whitespace at the end:*
Keyword: “test result ”
Result:
This is *test result*
We have to undergo *test*
Result will come by *tomorrow*
**
*To address this issue, we have created a copy field for the field
“bodycontent_t” which is used to list the results. And used ‘keyword
tokenizer’ analyzer to consider the space at the end.*
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@solr.apache.org
For additional commands, e-mail: dev-h...@solr.apache.org