This is almost certainly not doing what you want.

     <tokenizer class="solr.KeywordTokenizerFactory"/>
     <filter class="solr.StopFilterFactory" words="stopwords.txt" 
ignoreCase="true"/>
     <filter class="solr.LowerCaseFilterFactory"/>

Instead, use StandardTokenizerFactory or WhitespaceTokenizerFactory. Remove 
StopFilterFactory, that can only cause problems.

     <tokenizer class="solrStandardTokenizerFactory"/>
     <filter class="solr.LowerCaseFilterFactory"/>

wunder
Walter Underwood
wun...@wunderwood.org
http://observer.wunderwood.org/  (my blog)

> On Nov 24, 2021, at 12:08 PM, Thamizhazhagan B <thamizhazhagan....@kp.org> 
> wrote:
> 
> Hi,
> 
> 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.
> 
> Copy field is as follows:
> 
> <fieldType name="bodyContent_type" class="solr.TextField" 
> sortMissingLast="true" omitNorms="true" positionIncrementGap="100" 
> multiValued="false">
>    <analyzer type="index">
>      <tokenizer class="solr.KeywordTokenizerFactory"/>
>      <filter class="solr.StopFilterFactory" words="stopwords.txt" 
> ignoreCase="true"/>
>      <filter class="solr.LowerCaseFilterFactory"/>
>    </analyzer>
>    <analyzer type="query">
>      <tokenizer class="solr.KeywordTokenizerFactory"/>
>      <filter class="solr.StopFilterFactory" words="stopwords.txt" 
> ignoreCase="true"/>
>      <filter class="solr.SynonymFilterFactory" expand="true" 
> ignoreCase="true" synonyms="synonyms.txt"/>
>      <filter class="solr.LowerCaseFilterFactory"/>
>    </analyzer>
>  </fieldType>
> 
> <copyField source="bodycontent_t" dest="bodyContentCopied"/>
>  <field name="bodyContentCopied" type="bodyContent_type" stored="true" 
> indexed="true" termVectors="true" termPositions="true" termOffsets="true"/>
> 
> But after the above changes, no results are return.  Please guide me how to 
> handle white space at the end.
> 
> Please suggest a solution fi this. Thanks for your support.
> 
> Thanks,
> Thamizh
> 
> NOTICE TO RECIPIENT:  If you are not the intended recipient of this e-mail, 
> you are prohibited from sharing, copying, or otherwise using or disclosing 
> its contents.  If you have received this e-mail in error, please notify the 
> sender immediately by reply e-mail and permanently delete this e-mail and any 
> attachments without reading, forwarding or saving them. v.173.295  Thank you.

Reply via email to