예제 #1
0
        public void ParseMlthMatch()
        {
            var innerParser = new MoreLikeThisHandlerMatchResponseParser <TestDocWithGuid>(GetDocumentParser <TestDocWithGuid>());
            var parser      = new SolrMoreLikeThisHandlerQueryResultsParser <TestDocWithGuid>(new[] { innerParser });
            var response    = EmbeddedResource.GetEmbeddedString(GetType(), "Resources.responseWithInterestingTermsDetails.xml");
            var results     = parser.Parse(response);

            Assert.IsNotNull(results);
            Assert.IsNotNull(results.Match);
            Assert.AreEqual(new Guid("224fbdc1-12df-4520-9fbe-dd91f916eba1"), results.Match.Key);
        }
예제 #2
0
        public void ParseInterestingTermsDetails()
        {
            var innerParser = new InterestingTermsResponseParser <Product>();
            var parser      = new SolrMoreLikeThisHandlerQueryResultsParser <Product>(new[] { innerParser });
            var response    = EmbeddedResource.GetEmbeddedString(GetType(), "Resources.responseWithInterestingTermsDetails.xml");
            var results     = parser.Parse(response);

            Assert.IsNotNull(results);
            Assert.IsNotNull(results.InterestingTerms);
            Assert.AreEqual(4, results.InterestingTerms.Count);
            Assert.AreEqual("content:three", results.InterestingTerms[2].Key);
            Assert.AreEqual(3.3f, results.InterestingTerms[2].Value);
        }
예제 #3
0
        public void ParseInterestingTermsList()
        {
            var innerParser = new InterestingTermsResponseParser <Product>();
            var parser      = new SolrMoreLikeThisHandlerQueryResultsParser <Product>(new[] { innerParser });
            var response    = EmbeddedResource.GetEmbeddedString(GetType(), "Resources.responseWithInterestingTermsList.xml");
            var results     = parser.Parse(response);

            Assert.NotNull(results);
            Assert.NotNull(results.InterestingTerms);
            Assert.Equal(4, results.InterestingTerms.Count);
            Assert.Equal("three", results.InterestingTerms[2].Key);
            Assert.True(results.InterestingTerms.All(t => t.Value == 0.0f));
        }