Lucene.net 中搜索的过滤器索引
我目前正在开发一个涉及 C# 中的 Lucene 库的项目,但是我在项目设计中遇到了有关索引中文档检索的问题。我的索引中的文档是用多个字段创建的,我希望能够在其中两个字段之间进行过滤,然后在这个子集中搜索术语,但是我仍然熟悉 lucene,并且不完全确定这是否可能。我已经学会了如何执行基本查询,但我认为我应该使用 lucenes 过滤器类,但我不太确定如何执行。如果有人能就此提供建议,我将不胜感激
。我正在完成的项目涉及对来自各种电子邮件帐户的电子邮件进行索引。我的索引中的文档具有以下一些字段: 帐户:(例如[电子邮件受保护]) 文件夹:(例如已发送、垃圾箱、收件箱...) 数据:(电子邮件正文)
我希望能够过滤我的索引,以便我可以拥有一个仅包含来自特定帐户和文件夹的文档的子集,然后在此之后我希望能够搜索该子集的数据字段。
I am currently working on a project involving the Lucene library within C# however I have reached an issue with design of my project concerning the retrevial of documents within the index. The documents within my index have been created with several fields and i'd like to be able to filter between two of these fields and then search this subset for terms however I am still familiarising myself with lucene and am not fully sure if this is possible. I have learnt how to perform basic queries but I think I should be using lucenes filter class but i am not exactly sure how. I would be greatful if anyone could offer advice on this
The project I am completing involves indexing email messages from various email accounts. the documents in my index have some of the following fields:
Account: (e.g. [email protected])
Folder: (e.g. sent, trash, inbox...)
Data: (the body of the email)
I'd like to be able to filter my index so i can have a subset which only containts documents from a particular account and folder and then after this I'd like to be able to search the data field of this subset.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如 @Jf Beaulac 所建议的,您可以使用 BooleanQuery 进行“过滤”。
这是一个关于查询和过滤器之间差异的好问题:为什么我们使用过滤器搜索时
As @Jf Beaulac suggested, you can do "filtering" with a BooleanQuery.
Here is a good question about the differences between queries and filters: Why do we use Filters while searching