从solr索引中删除电子邮件地址 [英] Remove email address from solr indexing

查看:176
本文介绍了从solr索引中删除电子邮件地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



例如,如果我有这样的电子邮件:foo@bar.com,Solr索引单词foo和barcom。



我想删除这些单词,但我不知道该怎么做。我尝试修改在我的索引字段中添加此规则的配置文件schema.xml:

 < filter class =solr。 PatternReplaceFilterFactorypattern =(。*)@(。*)replacement =replace =all/> 

但是,它不起作用。

解决方案

您可以将令牌检测为电子邮件地址并使用

 < fieldType name =emailsclass =solr.TextFieldsortMissingLast = trueomitNorms =true> 
< analyzer>
< tokenizer class =solr.UAX29URLEmailTokenizerFactory/>
< filter class =solr.TypeTokenFilterFactorytypes =email_type.txtuseWhitelist =true/>
< / analyzer>
< / fieldType>


When Solr build the index, it gets parts of email address.

For exemple, if i have an email like this : foo@bar.com, Solr indexes the words "foo" and "barcom".

I want to remove theses words but I don't know how to do this. I tried to modify the configuration file schema.xml adding this rule on my indexed field :

<filter class="solr.PatternReplaceFilterFactory" pattern=" (.*)@(.*) " replacement=" " replace="all"/>

However, it doesn't work.

解决方案

You can detect tokens as a e-mailaddress and blacklist them using

  <fieldType name="emails" class="solr.TextField" sortMissingLast="true" omitNorms="true">
  <analyzer>
    <tokenizer class="solr.UAX29URLEmailTokenizerFactory"/>
    <filter class="solr.TypeTokenFilterFactory" types="email_type.txt" useWhitelist="true"/>
  </analyzer>
</fieldType>

这篇关于从solr索引中删除电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆