Question

I'm trying to implement the Lucene.Net MoreLikeThis query but it doesn't seem to be able to find anything interesting in the document to search the index.

In my scenario, the user has clicked "More Like This" link on the search results webpage, this passes the document id on the query string. My Lucene.Net code looks like this:

var similarSearch = new MoreLikeThis(reader);
similarSearch.SetFieldNames(new[] { "Place", "Subject", "Description", "Name", "Town", "Occupation" });
similarSearch.MinWordLen = 3;
similarSearch.Boost = true;

var terms = similarSearch.RetrieveInterestingTerms(docid);
var doc = reader[docid];

var searchQuery = similarSearch.Like(docid);

Following execution; the terms variable is an empty array, the doc variable contains the document and the searchQuery has no clauses. When I run the search using the query it returns no documents.

My conclusion is I am able to get the document from the reader, but the MoreLikeThis object is unable to find anything to build a query from.

Any idea why?

No correct solution

OTHER TIPS

I think you may need to set one or more of the following parameters on the MoreLikeThis object: Analyzer, MinTermFreq, and/or MinDocFreq

I had the same issue - no results being returned. Once I set the above parameters (try setting both of the minimums to 1), it worked.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top