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:
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?
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!