开发者

SOLR ignoring comma and other punctuation while searching

开发者 https://www.devze.com 2023-01-26 17:45 出处:网络
I want to search 100,000 and 开发者_如何转开发100000 only by querying 100000 (or only by querying 100,000).

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...


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

You have some docs here: WordDelimiterFactory


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.


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消