Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要一些关于如何正确索引代表货币的字段的指导。 我需要 130 来匹配 130.64。我尝试了下面的 trie float 配置。
<fieldType name="float" class="solr.TrieFloatField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
当我在该字段中搜索 130 时,我没有得到任何结果。我试过增加和减少精度无济于事。
我如何让它索引部分数字?
您不能直接使浮点字段 (TrieFloatField) 与整数部分匹配(只需传递“数字”)。您要做的是对数字进行范围查询:
字段名:{130 到 131} 或 130
只需将其作为 textTield 进行索引,然后您可以将其与通配符查询匹配,或者您可以制作 ngram 并匹配查询。