简体   繁体   English

Lucene通过数值搜索

[英]Lucene searching by numeric values

I'm building a Java Lucene-based search system that, on addition, adds a certain number of meta-fields, one of which is a sourceId field, which denotes where the entry came from. 我正在构建一个基于Java Lucene的搜索系统,该系统还添加了一定数量的元字段,其中一个是sourceId字段,它表示条目的来源。

I'm now trying to retrieve all documents from a particular source, but the index doesn't appear to be able to find them. 我现在正尝试从特定来源检索所有文档,但是索引似乎无法找到它们。 However, if I search for a wildcard value, the returned documents all have the correct value for this field. 但是,如果我搜索通配符值,则返回的文档对于此字段均具有正确的值。

The lucene query I'm using is quite simple, basically index-source-id:1 but that fails to return any hits, if I search for content:a* I get dozens of documents, all of which, when asked, return the value 1 for the index-source-id value, which is correct. 我正在使用的lucene查询非常简单,基本上是index-source-id:1但是如果我搜索content:a* ,则不会返回任何匹配content:a*我得到了许多文档,当被问到时,所有这些文档都返回值1index-source-id值,该值是正确的。

Any ideas? 有任何想法吗?

I have only worked with the PHP port, however, have you checked what text analyzer you are using? 我仅使用PHP端口,但是,您是否检查了正在使用的文本分析器? This FAQ seems to indicate that like the PHP version, you need to use a diffrent one that doesn't remove digits. 常见问题解答似乎表明与PHP版本一样,您需要使用不删除数字的其他版本。
You can find a list of analyzers here 您可以在此处找到分析仪列表

Just to be sure, you have set the id to be indexable? 只是为了确保您已将ID设置为可索引?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM