SOLR ignoring comma and other punctuation while searching

荒凉一梦 提交于 2019-12-11 16:58:13

问题


I want to search 100,000 and 100000 only by querying 100000 (or only by querying 100,000).
Is it possible to search like that.

The purpose to perform this is, that user may add a comma at any place or no comma at all but the strings (100,000 or 100000) should be searched anyway...


回答1:


Don't know if this is correct, but maybe you can write some kind of filter factory where numbers are always indexed as numbers formatted with commas and with out commas. Or you can have both the index & query analyzer store the word w/o comma.




回答2:


Try using solr.WordDelimiterFilterFactory with catenateNumbers="1" in the index and query definition of you field.

You have some docs here: WordDelimiterFactory




回答3:


just remove the , from the query if it is in a number

(if you are using java at the client -> parse the number and do toString)



来源:https://stackoverflow.com/questions/4255172/solr-ignoring-comma-and-other-punctuation-while-searching

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!