Lucene 按数值搜索

发布于 2024-08-15 09:46:08 字数 343 浏览 1 评论 0原文

我正在构建一个基于 Java Lucene 的搜索系统,该系统还添加了一定数量的元字段,其中之一是 sourceId 字段,它表示条目的来源。

我现在尝试从特定来源检索所有文档,但索引似乎无法找到它们。但是,如果我搜索通配符值,则返回的文档都具有该字段的正确值。

我使用的 lucene 查询非常简单,基本上是 index-source-id:1 但无法返回任何命中,如果我搜索 content:a* 我获取数十个文档,所有这些文档在被询问时都会返回 index-source-id1,这是正确的。

有什么想法吗?

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.

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.

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

撞了怀 2024-08-22 09:46:08

我只使用过 PHP 端口,但是,您检查过您使用的是什么文本分析器吗?这个 FAQ 似乎表明,像 PHP 版本一样,您需要使用不删除数字的不同的。
您可以在此处找到分析器列表

只是为了确定,您已将 id 设置为可索引吗?

I have only worked with the PHP port, however, have you checked what text analyzer you are using? This FAQ seems to indicate that like the PHP version, you need to use a diffrent one that doesn't remove digits.
You can find a list of analyzers here

Just to be sure, you have set the id to be indexable?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文