Lucene - Wildcards in phrases(Lucene - 短语中的通配符)
问题描述
我目前正在尝试使用 Lucene 搜索填充在索引中的数据.
I am currently attempting to use Lucene to search data populated in an index.
我可以通过将其括在括号中来匹配确切的短语(即处理文档"),但无法让 Lucene 通过执行任何类型的处理文档*"来找到该短语.
I can match on exact phrases by enclosing it in brackets (i.e. "Processing Documents"), but cannot get Lucene to find that phrase by doing any sort of "Processing Document*".
明显的区别是末尾的通配符.
The obvious difference being the wildcard at the end.
我目前正在尝试使用 Luke 来查看和搜索索引.(解析时会去掉短语末尾的星号)
I am currently attempting to use Luke to view and search the index. (it drops the asterisk at the end of the phrase when parsing)
在数据周围添加引号似乎是主要的罪魁祸首,因为搜索 document* 会起作用,但 "document*" 不起作用
Adding the quotes around the data seems to be the main culprit as searching for document* will work, but "document*" does not
任何帮助将不胜感激
推荐答案
QueryParser 不仅不支持词组中的通配符,而且 PhraseQuery 本身只支持词组.MultiPhraseQuery 更近了,但正如其摘要所说,您仍然需要自己枚举 IndexReader.terms 以匹配通配符.
Not only does the QueryParser not support wildcards in phrases, PhraseQuery itself only supports Terms. MultiPhraseQuery comes closer, but as its summary says, you still need to enumerate the IndexReader.terms yourself to match the wildcard.
这篇关于Lucene - 短语中的通配符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Lucene - 短语中的通配符


基础教程推荐
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01