Lucene.net 中的多个过滤器
如何在一次搜索中组合多个过滤器?
例如,我有可分析字段 title 的记录,但不可分析字段 id1、id2、id3、发布日期。我想使用 id1、id2、id3 和 release_date 的特定过滤器查找所有记录;所以,我有:
RangeFilter refReleaseDateFilter = new RangeFilter("release_date",
refFromDateTimeTerm.Text(), refToDateTimeTerm.Text(), true, true);
RangeFilter refId1Filter = new RangeFilter("id1",
refFromId1Term.Text(), refToId1Term.Text(), true, true);
RangeFilter refId2Filter = new RangeFilter("id2",
refFromId2Term.Text(), refToId2Term.Text(), true, true);
RangeFilter refId3Filter = new RangeFilter("id3",
refFromId3Term.Text(), refToId3Term.Text(), true, true);
但是IndexSearcher类的方法Search不提供过滤器数组。
请帮助我:) 谢谢!:)
How to combine multiple filters within one search?
For example I have record with analyzable field title and not analyzable fields id1, id2, id3, release_date. I want to find all records using specific filters for id1, id2, id3 and release_date; So, I have:
RangeFilter refReleaseDateFilter = new RangeFilter("release_date",
refFromDateTimeTerm.Text(), refToDateTimeTerm.Text(), true, true);
RangeFilter refId1Filter = new RangeFilter("id1",
refFromId1Term.Text(), refToId1Term.Text(), true, true);
RangeFilter refId2Filter = new RangeFilter("id2",
refFromId2Term.Text(), refToId2Term.Text(), true, true);
RangeFilter refId3Filter = new RangeFilter("id3",
refFromId3Term.Text(), refToId3Term.Text(), true, true);
But the method Search of class IndexSearcher does not provide array of filters.
Please help me:) Thank you!:)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用类似 ChainedFilter 的东西
,请参阅: http://lucene.apache.org/java/2_9_0/api/contrib-misc/org/apache/lucene/misc/ChainedFilter.html
还有一个lucene .net 发行版中的 ChainedFilter。
http://www.koders.com/csharp/fidB8682543372DDC9772496D453F39957A94E58466.aspx?s=system#L3
另一种选择是将其实现为java应用程序的端口,但不是那么多代码。
You may use something like a ChainedFilter
see.: http://lucene.apache.org/java/2_9_0/api/contrib-misc/org/apache/lucene/misc/ChainedFilter.html
there is also a ChainedFilter in the .net distribution of lucene.
http://www.koders.com/csharp/fidB8682543372DDC9772496D453F39957A94E58466.aspx?s=system#L3
Another option would be to implement it as a port of the java application it is not that much code.
在 Lucene.NET 3.0.3 中使用单个
BooleanQuery
对我有用:Using a single
BooleanQuery
worked for me with Lucene.NET 3.0.3: