使用LUKE进行Lucene数值范围搜索 [英] Lucene numeric range search with LUKE

查看:202
本文介绍了使用LUKE进行Lucene数值范围搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有许多数字Lucene索引字段:

I have a number of numeric Lucene indexed fields:

60000
78500
105000

如果我使用LUKE查询78500,如下所示:

If I use LUKE to query for 78500 as follows:

price:78500

它返回正确的记录,但是,如果我尝试将所有三个记录作为范围返回,则我没有结果。

It returns the correct record, however if I try to return all three record as a range I get no results.

price:[60000 TO 105000]

我意识到这是由于填充因为Lucene对数字进行处理,但我只是想知道我应该知道什么将LUKE归还给三条记录。

I realise this is due to padding as numbers are treated strings by Lucene however I just wish to know what I should be putting into LUKE to return the three records.

非常感谢您的帮助。

推荐答案

我用于此的解决方案是为价格输入的值需要以填充形式添加到索引中。然后我会查询新的填充值,它很有用。因此,指数中的新值为:

The solution I used for this was that the values inputted for price needed to be added to the index in padded form. Then I would just query the new padded value which works great. Therefore the new values in the index were:

060000
078500
105000

此解决方案与Umbraco的检查搜索问题相关联,因此论坛上有一个关于如何实现基于数字的范围的线程搜索是否有人要求它,它位于这里,端到端走动。

This solution was tied into an Examine search issue for Umbraco so there is a thread on the Forum of how to implement a numeric based range search if anyone requires this it is located here with a walk through end to end.

Umbraco论坛帖子

这篇关于使用LUKE进行Lucene数值范围搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆