You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@nutch.apache.org by UMA MAHESWAR <um...@in.ebmpapst.com> on 2018/10/22 06:30:07 UTC

Character replace in solr

Hi,


i am using solr 5.5.0 and need to replace special characters{-_/} in solr
while querying time.


Thanks,

A. Uma Maheswar Reddy




--
Sent from: http://lucene.472066.n3.nabble.com/Nutch-User-f603147.html

RE: Character replace in solr

Posted by Sadiki Latty <sl...@uottawa.ca>.
Hey Uma,

Charfilters should be able to assist you with this.

https://archive.apache.org/dist/lucene/solr/ref-guide/apache-solr-ref-guide-5.5.pdf

solr.PatternReplaceCharFilterFactory or solr.MappingCharFilterFactory depending what you are trying to accomplish. 

As for the extra requirement of doing it at query time, you can simply separate your analyzer into query and index.

For example


<fieldType name="nametext" class="solr.TextField">
  <analyzer type="index">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.KeepWordFilterFactory" words="keepwords.txt"/>
    <filter class="solr.SynonymFilterFactory" synonyms="syns.txt"/>
  </analyzer>
  <analyzer type="query">
    <charFilter class="solr.MappingCharFilterFactory" mapping="mapping-FoldToASCII.txt"/>
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
</fieldType>


Hope this helps


Sid


-----Original Message-----
From: UMA MAHESWAR [mailto:uma.maheswar@in.ebmpapst.com] 
Sent: October 22, 2018 2:30 AM
To: user@nutch.apache.org
Subject: Character replace in solr

Hi,


i am using solr 5.5.0 and need to replace special characters{-_/} in solr while querying time.


Thanks,

A. Uma Maheswar Reddy




--
Sent from: http://lucene.472066.n3.nabble.com/Nutch-User-f603147.html