Solr中的ToTitleCase停止Solr中的SCREAMING CAPS [英] ToTitleCase in solr to stop SCREAMING CAPS in Solr
问题描述
我正在使用solr的构面,但遇到了一个我希望可以使用滤镜解决的问题.
I'm using solr's faceting and i've run into a problem that i was hoping i could get around using filters.
基本上有些时候,城镇名称会以
Basically some times a town name will come through to SOLR as
剑桥"
有时它会以
剑桥"
我想在Solr中使用过滤器来停止城镇名称的SCREAMING CAPS版本.似乎所有文本都小写. >
I wanted to use a filter in Solr to stop the SCREAMING CAPS version of the town name. It seems there is a fitler to make all the text lower case.
<!-- A text field that only sorts out casing for faceting -->
<fieldType name="text_facet" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
我想知道是否有人知道一个过滤器,该过滤器将忽略单词的第一个字符并将小写字母应用于其余字符.例如
I was wondering if anyone knew of a filter which will Ignore the First character of a word and apply lowercase to the rest of the characters. E.g.
- 剑桥>>剑桥
- 赫尔河畔金斯顿>>赫尔河畔金斯顿
等
或者,如果编写自己的过滤器很容易..在此方面的一些帮助将不胜感激..我不是Java语言的人.
Alternatively if it's easy to write your own filters.. some help on how to do that would be appreciated.. I'm not a Java person..
谢谢
推荐答案
AFAIK没有这样的内置过滤器.如果要编写,请参见 LowerCaseFilter 供参考,似乎并不难.
AFAIK there is no built-in filter like that. If you want to write it, see LowerCaseFilterFactory and LowerCaseFilter for reference, it doesn't seem to be very hard.
或者您可以执行此客户端操作,即在SolrNet中,您可以编写一个ISolrOperations装饰器,该装饰器使用
Or you could do this client-side, i.e. in SolrNet you could write a ISolrOperations decorator that does the necessary transformations after the real query, using ToTitleCase.
这篇关于Solr中的ToTitleCase停止Solr中的SCREAMING CAPS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!