예제 #1
0
        public void GetAllParameters_mlt_with_stream_url_query()
        {
            var qe = new SolrQueryExecuter <TestDocument>(null, null, null, null, null);
            var p  = qe.GetAllMoreLikeThisHandlerParameters(
                new SolrMoreLikeThisHandlerStreamUrlQuery("http://wiki.apache.org/solr/MoreLikeThisHandler"),
                new MoreLikeThisHandlerQueryOptions(
                    new MoreLikeThisHandlerParameters(new[] { "one", "three" })
            {
                MatchInclude = false,
                MatchOffset  = 5,
                ShowTerms    = InterestingTerms.None,
            })
            {
                Start  = 0,
                Rows   = 5,
                Fields = new[] { "one", "two", "three" },
            }).ToList();

            Assert.Contains(p, KV.Create("stream.url", "http://wiki.apache.org/solr/MoreLikeThisHandler"));
        }
예제 #2
0
        public void GetAllParameters_mlt_with_stream_body_query()
        {
            var qe = new SolrQueryExecuter <TestDocument>(null, null, null, null, null);
            var p  = qe.GetAllMoreLikeThisHandlerParameters(
                new SolrMoreLikeThisHandlerStreamBodyQuery("one two three"),
                new MoreLikeThisHandlerQueryOptions(
                    new MoreLikeThisHandlerParameters(new[] { "one", "three" })
            {
                MatchInclude = false,
                MatchOffset  = 5,
                ShowTerms    = InterestingTerms.None,
            })
            {
                Start  = 0,
                Rows   = 5,
                Fields = new[] { "one", "two", "three" },
            }).ToList();

            CollectionAssert.Contains(p, KV.Create("stream.body", "one two three"));
        }
예제 #3
0
        public void GetAllParameters_mlt_with_stream_body_query()
        {
            var mocks  = new MockRepository();
            var parser = mocks.DynamicMock <ISolrQueryResultParser <TestDocument> >();
            var conn   = mocks.DynamicMock <ISolrConnection>();
            var qe     = new SolrQueryExecuter <TestDocument>(parser, conn, null, null, null);
            var p      = qe.GetAllMoreLikeThisHandlerParameters(
                new SolrMoreLikeThisHandlerStreamBodyQuery("one two three"),
                new MoreLikeThisHandlerQueryOptions(
                    new MoreLikeThisHandlerParameters(new[] { "one", "three" })
            {
                MatchInclude = false,
                MatchOffset  = 5,
                ShowTerms    = InterestingTerms.None,
            })
            {
                Start  = 0,
                Rows   = 5,
                Fields = new[] { "one", "two", "three" },
            }).ToList();

            Assert.Contains(p, KV.Create("stream.body", "one two three"));
        }
예제 #4
0
 public void GetAllParameters_mlt_with_stream_url_query()
 {
     var qe = new SolrQueryExecuter<TestDocument>(null, null, null, null, null);
     var p = qe.GetAllMoreLikeThisHandlerParameters(
         new SolrMoreLikeThisHandlerStreamUrlQuery("http://wiki.apache.org/solr/MoreLikeThisHandler"),
         new MoreLikeThisHandlerQueryOptions(
             new MoreLikeThisHandlerParameters(new[] { "one", "three" })
             {
                 MatchInclude = false,
                 MatchOffset = 5,
                 ShowTerms = InterestingTerms.None,
             })
             {
                 Start = 0,
                 Rows = 5,
                 Fields = new[] { "one", "two", "three" },
             }).ToList();
     Assert.Contains(p, KV.Create("stream.url", "http://wiki.apache.org/solr/MoreLikeThisHandler"));
 }
예제 #5
0
 public void GetAllParameters_mlt_with_field_query()
 {
     var serializer = new DefaultQuerySerializer(new DefaultFieldSerializer());
     var qe = new SolrQueryExecuter<TestDocument>(null, null, serializer, null, null);
     var p = qe.GetAllMoreLikeThisHandlerParameters(
         new SolrMoreLikeThisHandlerQuery(new SolrQueryByField("id", "1234")),
         new MoreLikeThisHandlerQueryOptions(
             new MoreLikeThisHandlerParameters(new[] { "one", "three" }) {
                 MatchInclude = false,
                 MatchOffset = 5,
                 ShowTerms = InterestingTerms.None,
             }) {
                 Start = 0,
                 Rows = 5,
                 Fields = new[] { "one", "two", "three" },
             }).ToList();
     Assert.Contains(p, KV.Create("q", "id:(1234)"));
     Assert.Contains(p, KV.Create("start", "0"));
     Assert.Contains(p, KV.Create("rows", "5"));
     Assert.Contains(p, KV.Create("fl", "one,two,three"));
     Assert.Contains(p, KV.Create("mlt.fl", "one,three"));
     Assert.Contains(p, KV.Create("mlt.match.include", "false"));
     Assert.Contains(p, KV.Create("mlt.match.offset", "5"));
     Assert.Contains(p, KV.Create("mlt.interestingTerms", "none"));
 }
예제 #6
0
 public void GetAllParameters_mlt_with_stream_body_query()
 {
     var qe = new SolrQueryExecuter<TestDocument>(null, null, null, null, null);
     var p = qe.GetAllMoreLikeThisHandlerParameters(
         new SolrMoreLikeThisHandlerStreamBodyQuery("one two three"),
         new MoreLikeThisHandlerQueryOptions(
             new MoreLikeThisHandlerParameters(new[] { "one", "three" })
             {
                 MatchInclude = false,
                 MatchOffset = 5,
                 ShowTerms = InterestingTerms.None,
             })
             {
                 Start = 0,
                 Rows = 5,
                 Fields = new[] { "one", "two", "three" },
             }).ToList();
     CollectionAssert.Contains(p, KV.Create("stream.body", "one two three"));
 }
예제 #7
0
 public void GetAllParameters_mlt_with_stream_body_query()
 {
     var mocks = new MockRepository();
     var parser = mocks.DynamicMock<ISolrQueryResultParser<TestDocument>>();
     var conn = mocks.DynamicMock<ISolrConnection>();
     var qe = new SolrQueryExecuter<TestDocument>(parser, conn, null, null, null);
     var p = qe.GetAllMoreLikeThisHandlerParameters(
         new SolrMoreLikeThisHandlerStreamBodyQuery("one two three"),
         new MoreLikeThisHandlerQueryOptions(
             new MoreLikeThisHandlerParameters(new[] {"one", "three"}) {
                 MatchInclude = false,
                 MatchOffset = 5,
                 ShowTerms = InterestingTerms.None,
             }) {
                 Start = 0,
                 Rows = 5,
                 Fields = new[] {"one", "two", "three"},
             }).ToList();
     Assert.Contains(p, KV.Create("stream.body", "one two three"));
 }