如何过滤 MoreLikeThis 查询
我正在使用 SOLR 并尝试过滤 MoreLikeThis 查询。每次我进行过滤时,我都会得到零结果。这是我正在使用的代码:
var results = solr.Query(new SolrQuery("id:" + id)
&& !new SolrQuery("siteid:" + SiteId), new QueryOptions
{
MoreLikeThis = new MoreLikeThisParameters(new[] { "content" })
{
MinDocFreq = 1,
MinTermFreq = 1,
Count = rows
},
Fields = new[] { "id" },
OrderBy = new[] { new SortOrder("score", Order.ASC) },
Start = start
});
如您所见 !new SolrQuery("site:" + SiteId)
是过滤器。当我在查询中添加此过滤器时,我没有得到任何结果。
这是查询的作用。我在 solr 索引中有一堆网页:
- id
- Title
- Content
- siteid
morelikethis 查询采用 id
然后获取类似的文档。该过滤器假设通过 siteid 过滤网页。当我应用 siteid 过滤器时,它不起作用。对此有什么想法吗?
I am using SOLR and trying to filter a MoreLikeThis query. Every time I do the filter I come up with zero results. Here is the code I am using:
var results = solr.Query(new SolrQuery("id:" + id)
&& !new SolrQuery("siteid:" + SiteId), new QueryOptions
{
MoreLikeThis = new MoreLikeThisParameters(new[] { "content" })
{
MinDocFreq = 1,
MinTermFreq = 1,
Count = rows
},
Fields = new[] { "id" },
OrderBy = new[] { new SortOrder("score", Order.ASC) },
Start = start
});
as you can see !new SolrQuery("site:" + SiteId)
is the filter. When I add this filter in the query I get no results.
Here is what the query does. I have a bunch of webpages in the solr index:
- id
- Title
- Content
- siteid
The morelikethis query takes a id
then fetches similar documents. The filter is suppose to filter webpages by the siteid. When I apply the siteid filter it does not work. Any ideas on this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来您想使用 MoreLikeThis 处理程序,而不是 MoreLikeThis 作为组件。
SolrNet 中有一个补丁实现了这一点,目前正在审查中。我鼓励您查看该补丁并向我们提供反馈!
It seems you want to use the MoreLikeThis handler, not MoreLikeThis as a component.
There is a patch implementing this in SolrNet, currently under review. I encourage you to take a look at the patch and give us feedback about it!