[英]simplest way to query Solr for an absolute value
I know similar questions have been asked WRT function querying, but I'd like to simply query Solr for a field with absolute value greater than or equal to something. 我知道有人问过WRT函数查询类似的问题,但我想简单地查询Solr以获取绝对值大于或等于某个值的字段。 for example, field change can be a negative or positive integer. 例如,字段更改可以是负整数或正整数。 I'd like to query (REST) along the lines of abs(change):[2 TO *]. 我想沿abs(change):[2 TO *]的行查询(REST)。 How would I accomplish this/is it possible? 我将如何完成/有可能吗?
Thanks in adv. 感谢在广告中。
Function Range Query Parser can be used for this: 函数范围查询解析器可用于此目的:
{!frange l=2}abs(change)
There is also a possibility to include(default)/exclude lower and upper bounds if needed. 如果需要,还可以包括(默认)/排除下限和上限。 More details available in Solr wiki . Solr Wiki中提供了更多详细信息。
In case there is a need to combine the function query with a regular one, the magic _val_ field name can be used: 如果需要将函数查询与常规查询结合使用,可以使用神奇的_val_字段名称:
field1:("xxxx") AND _val_:"{!frange l=2}abs(change)"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.