开发者

Solr - Find whole numberin float field

开发者 https://www.devze.com 2023-03-28 17:45 出处:网络
I need some guidance on how to properly index a field representing money. I need 130 to match 130开发者_运维问答.64.I tried the trie float configuration below.

I need some guidance on how to properly index a field representing money.

I need 130 to match 130开发者_运维问答.64. I tried the trie float configuration below.

<fieldType name="float" class="solr.TrieFloatField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>

When I search in the field for 130 I get no results. I have tried increasing and decreasing the precision to no avail.

How do I get this to index parts of the number?


You cannot directly make the float field (TrieFloatField) match the whole number part (by just passing the "number"). What you have to do is a range query over the number:

fieldname:{130 TO 131} OR 130


Just index it as a textTield and then you can match it with wildcard query or you can make ngrams and match query on those.

0

精彩评论

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