public void MoreLikeThisHandler() { var solr = ServiceLocator.Current.GetInstance <ISolrOperations <Product> >(); solr.Delete(SolrQuery.All); solr.Commit(); AddSampleDocs(); var mltParams = new MoreLikeThisHandlerParameters(new[] { "cat", "name" }) { MatchInclude = true, MinTermFreq = 1, MinDocFreq = 1, ShowTerms = InterestingTerms.List, }; var q = SolrMLTQuery.FromQuery(new SolrQuery("id:UTF8TEST")); var results = solr.MoreLikeThis(q, new MoreLikeThisHandlerQueryOptions(mltParams)); Assert.Equal(2, results.Count); Assert.NotNull(results.Match); Assert.Equal("UTF8TEST", results.Match.Id); Assert.True(results.InterestingTerms.Count > 0); foreach (var t in results.InterestingTerms) { Console.WriteLine("Interesting term: {0} ({1})", t.Key, t.Value); } }
public void MoreLikeThisHandler() { var mltParams = new MoreLikeThisHandlerParameters(new[] { "cat", "name" }) { MatchInclude = true, MinTermFreq = 1, MinDocFreq = 1, ShowTerms = InterestingTerms.List, }; var q = SolrMLTQuery.FromQuery(new SolrQuery("id:UTF8TEST")); var results = solr.MoreLikeThis(q, new MoreLikeThisHandlerQueryOptions(mltParams)); Assert.AreEqual(2, results.Count); Assert.IsNotNull(results.Match); Assert.AreEqual("UTF8TEST", results.Match.Id); Assert.That(results.InterestingTerms.Count, Is.GreaterThan(0)); }