• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# SolrBasicServer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中SolrBasicServer的典型用法代码示例。如果您正苦于以下问题:C# SolrBasicServer类的具体用法?C# SolrBasicServer怎么用?C# SolrBasicServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SolrBasicServer类属于命名空间,在下文中一共展示了SolrBasicServer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Add

 public void Add()
 {
     var mocks = new MockRepository();
     var connection = mocks.StrictMock<ISolrConnection>();
     var executer = mocks.StrictMock<ISolrQueryExecuter<TestDocumentWithoutUniqueKey>>();
     var headerParser = mocks.StrictMock<ISolrHeaderResponseParser>();
     var docSerializer = new SolrDocumentSerializer<TestDocumentWithoutUniqueKey>(new AttributesMappingManager(), new DefaultFieldSerializer());
     With.Mocks(mocks)
         .Expecting(() => {
             Expect.On(connection)
                 .Call(connection.Post("/update", "<add><doc /></add>"))
                 .Repeat.Once()
                 .Return(EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml"));
             Expect.On(headerParser)
                 .Call(headerParser.Parse(null))
                 .IgnoreArguments()
                 .Return(new ResponseHeader());
         })
         .Verify(() => {
             var ops = new SolrBasicServer<TestDocumentWithoutUniqueKey>(connection, executer, docSerializer, null, headerParser, null, null, null);
             ops.AddWithBoost(new[] {
                 new KeyValuePair<TestDocumentWithoutUniqueKey, double?>(new TestDocumentWithoutUniqueKey(), null),
             }, null);
         });
 }
开发者ID:Cort01,项目名称:SolrNet,代码行数:25,代码来源:SolrOperationsTests.cs


示例2: AddWithBoost

 public void AddWithBoost()
 {
     var mocks = new MockRepository();
     var connection = mocks.CreateMock<ISolrConnection>();
     var executer = mocks.CreateMock<ISolrQueryExecuter<TestDocumentWithoutUniqueKey>>();
     var docSerializer = new SolrDocumentSerializer<TestDocumentWithoutUniqueKey>(new AttributesMappingManager(), new DefaultFieldSerializer());
     With.Mocks(mocks)
         .Expecting(() => Expect.Call(connection.Post("/update", "<add><doc boost=\"2.1\" /></add>"))
                              .Repeat.Once()
                              .Return(null))
         .Verify(() => {
             var ops = new SolrBasicServer<TestDocumentWithoutUniqueKey>(connection, executer, docSerializer);
             ops.AddWithBoost(new[] {new KeyValuePair<TestDocumentWithoutUniqueKey, double?>(new TestDocumentWithoutUniqueKey(), 2.1),});
         });
 }
开发者ID:osdezwart,项目名称:SolrNet,代码行数:15,代码来源:SolrOperationsTests.cs


示例3: FilterQueries

 public void FilterQueries()
 {
     var conn = new MockConnection(new Dictionary<string, string> {
         {"fq", "id:0"},
         {"q", "*:*"},
         {"rows", "100000000"},
     });
     var mocks = new MockRepository();
     var queryExec = mocks.StrictMock<ISolrQueryExecuter<Document>>();
     var docSerializer = mocks.StrictMock<ISolrDocumentSerializer<Document>>();
     ISolrBasicReadOnlyOperations<Document> solr = new SolrBasicServer<Document>(conn, queryExec, docSerializer, null, null, null, null, null);
     solr.Query(SolrQuery.All, new QueryOptions {
         FilterQueries = new[] {new SolrQuery("id:0")},
     });
 }
开发者ID:Cort01,项目名称:SolrNet,代码行数:15,代码来源:FilterQueryTests.cs


示例4: AddWithParameters

 public void AddWithParameters() {
     var xml = EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml");
     var connection = new MSolrConnection();
     connection.post += (url, content) => {
         Assert.AreEqual("/update", url);
         Assert.AreEqual("<add commitWithin=\"4343\" overwrite=\"false\"><doc /></add>", content);
         return xml;
     };
     var docSerializer = new SolrDocumentSerializer<TestDocumentWithoutUniqueKey>(new AttributesMappingManager(), new DefaultFieldSerializer());
     var headerParser = new MSolrHeaderResponseParser();
     headerParser.parse = headerParser.parse.Return(null);
     var ops = new SolrBasicServer<TestDocumentWithoutUniqueKey>(connection, null, docSerializer, null, headerParser, null, null, null);
     var parameters = new AddParameters { CommitWithin = 4343, Overwrite = false };
     ops.AddWithBoost(new[] { new KeyValuePair<TestDocumentWithoutUniqueKey, double?>(new TestDocumentWithoutUniqueKey(), null), }, parameters);
     Assert.AreEqual(1, connection.post.Calls);
 }
开发者ID:FilipVV,项目名称:SolrNet,代码行数:16,代码来源:SolrOperationsTests.cs


示例5: AddWithBoost

        public void AddWithBoost()
        {
            var connection = new MSolrConnection();
            connection.post += (url, content) => {
                Assert.AreEqual("/update", url);
                Assert.AreEqual("<add><doc boost=\"2.1\" /></add>", content);
                return EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml");
            };
            var docSerializer = new SolrDocumentSerializer<TestDocumentWithoutUniqueKey>(new AttributesMappingManager(), new DefaultFieldSerializer());
            var headerParser = new MSolrHeaderResponseParser();
            headerParser.parse = headerParser.parse.Return(null);
            var ops = new SolrBasicServer<TestDocumentWithoutUniqueKey>(connection, null, docSerializer, null, headerParser, null, null, null);
            ops.AddWithBoost(new[] { new KeyValuePair<TestDocumentWithoutUniqueKey, double?>(new TestDocumentWithoutUniqueKey(), 2.1), }, null);

            Assert.AreEqual(1, connection.post.Calls);
        }
开发者ID:rivuc,项目名称:SolrNet-1,代码行数:16,代码来源:SolrOperationsTests.cs


示例6: Add

        public void Add() {
            var xml = EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml");
            var connection = new MSolrConnection();
            connection.post = connection.post
                .Expect(1)
                .Args("/update", "<add><doc /></add>")
                .Return(xml);

            var headerParser = new MSolrHeaderResponseParser();
            headerParser.parse = headerParser.parse.Return(null);

            var docSerializer = new SolrDocumentSerializer<TestDocumentWithoutUniqueKey>(new AttributesMappingManager(), new DefaultFieldSerializer());
            var ops = new SolrBasicServer<TestDocumentWithoutUniqueKey>(connection, null, docSerializer, null, headerParser, null, null, null);
            ops.AddWithBoost(new[] {
                new KeyValuePair<TestDocumentWithoutUniqueKey, double?>(new TestDocumentWithoutUniqueKey(), null),
            }, null);
            connection.post.Verify();
        }
开发者ID:FilipVV,项目名称:SolrNet,代码行数:18,代码来源:SolrOperationsTests.cs


示例7: Collection

        public void Collection()
        {
            var conn = new MockConnection(new Dictionary<string, string> {
                {"fq", "id:0"},
                {"q", "*:*"},
                {"rows", "100000000"},
            });
            var mocks = new MockRepository();
            var queryExec = mocks.StrictMock<ISolrQueryExecuter<Document>>();
            var docSerializer = mocks.StrictMock<ISolrDocumentSerializer<Document>>();
            ISolrBasicReadOnlyOperations<Document> solr = new SolrBasicServer<Document>(conn, queryExec, docSerializer, null, null, null, null, null);

            var linqQuery = from doc in solr.AsQueryable()
                            where doc.Categories.AnyItem() == "cat1"
                            select doc;

            QueryOptions qo;
            var resDocs = ((IQueryableSolrNet<Document>)linqQuery).GetSolrQuery(out qo);

            Assert.AreEqual("(cat:cat1)", resDocs.Query);
        }
开发者ID:Cort01,项目名称:SolrNet,代码行数:21,代码来源:QueryableSolrNetTester.cs


示例8: Boosting

        public void Boosting()
        {
            var conn = new MockConnection(new Dictionary<string, string> {
                {"fq", "id:0"},
                {"q", "*:*"},
                {"rows", "100000000"},
            });
            var mocks = new MockRepository();
            var queryExec = mocks.StrictMock<ISolrQueryExecuter<Document>>();
            var docSerializer = mocks.StrictMock<ISolrDocumentSerializer<Document>>();
            ISolrBasicReadOnlyOperations<Document> solr = new SolrBasicServer<Document>(conn, queryExec, docSerializer, null, null, null, null, null);

            var linqQuery = from doc in solr.AsQueryable()
                            where (doc.Name == "john").Boost(10)
                            select doc;

            QueryOptions qo;
            var resDocs = ((IQueryableSolrNet<Document>)linqQuery).GetSolrQuery(out qo);

            Assert.AreEqual("(name:john)^10", resDocs.Query);
        }
开发者ID:Cort01,项目名称:SolrNet,代码行数:21,代码来源:QueryableSolrNetTester.cs


示例9: AndsOrs

        public void AndsOrs()
        {
            var conn = new MockConnection(new Dictionary<string, string> {
                {"fq", "id:0"},
                {"q", "*:*"},
                {"rows", "100000000"},
            });
            var mocks = new MockRepository();
            var queryExec = mocks.StrictMock<ISolrQueryExecuter<Document>>();
            var docSerializer = mocks.StrictMock<ISolrDocumentSerializer<Document>>();
            ISolrBasicReadOnlyOperations<Document> solr = new SolrBasicServer<Document>(conn, queryExec, docSerializer, null, null, null, null, null);

            var linqQuery = from doc in solr.AsQueryable()
                            where doc.DefaultFieldEquals("aa") && (doc.Price >= 1 || doc.Price <= 11)
                            select doc;

            QueryOptions qo;
            var resDocs = ((IQueryableSolrNet<Document>)linqQuery).GetSolrQuery(out qo);

            Assert.AreEqual("(aa AND ((price:[1 TO *]) OR (price:[* TO  11])))", resDocs.Query);
        }
开发者ID:Cort01,项目名称:SolrNet,代码行数:21,代码来源:QueryableSolrNetTester.cs


示例10: Extract

 public void Extract()
 {
     var mocks = new MockRepository();
     var connection = mocks.StrictMock<ISolrConnection>();
     var executer = mocks.StrictMock<ISolrQueryExecuter<TestDocumentWithoutUniqueKey>>();
     var headerParser = mocks.StrictMock<ISolrHeaderResponseParser>();
     var extractResponseParser = mocks.StrictMock<ISolrExtractResponseParser>();
     var docSerializer = new SolrDocumentSerializer<TestDocumentWithoutUniqueKey>(new AttributesMappingManager(), new DefaultFieldSerializer());
     var parameters = new ExtractParameters(null, "1", "test.doc");
     With.Mocks(mocks)
         .Expecting(() => {
             Expect.On(connection)
                 .Call(connection.PostStream("/update/extract", null, parameters.Content, new List<KeyValuePair<string, string>> {
                     new KeyValuePair<string, string>("literal.id", parameters.Id),
                     new KeyValuePair<string, string>("resource.name", parameters.ResourceName),
                 }))
                 .Repeat.Once()
                 .Return(EmbeddedResource.GetEmbeddedString(GetType(), "Resources.responseWithExtractContent.xml"));
             Expect.On(extractResponseParser)
                 .Call(extractResponseParser.Parse(null))
                 .IgnoreArguments()
                 .Return(new ExtractResponse(null));
         })
         .Verify(() => {
             var ops = new SolrBasicServer<TestDocumentWithoutUniqueKey>(connection, executer, docSerializer, null, headerParser, null, null, extractResponseParser);
             ops.Extract(parameters);
         });
 }
开发者ID:Cort01,项目名称:SolrNet,代码行数:28,代码来源:SolrOperationsTests.cs


示例11: DeleteByQuery

 public void DeleteByQuery()
 {
     var mocks = new MockRepository();
     var connection = mocks.StrictMock<ISolrConnection>();
     var headerParser = mocks.StrictMock<ISolrHeaderResponseParser>();
     var executer = mocks.StrictMock<ISolrQueryExecuter<TestDocumentWithUniqueKey>>();
     var docSerializer = mocks.StrictMock<ISolrDocumentSerializer<TestDocumentWithUniqueKey>>();
     var querySerializer = mocks.StrictMock<ISolrQuerySerializer>();
     With.Mocks(mocks)
         .Expecting(() => {
             Expect.On(querySerializer)
                 .Call(querySerializer.Serialize(null))
                 .IgnoreArguments()
                 .Return("id:123");
             Expect.On(connection)
                 .Call(connection.Post("/update", "<delete><query>id:123</query></delete>"))
                 .Repeat.Once()
                 .Return(EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml"));
             Expect.On(headerParser)
                 .Call(headerParser.Parse(null))
                 .IgnoreArguments()
                 .Return(new ResponseHeader());
         })
         .Verify(() => {
             var ops = new SolrBasicServer<TestDocumentWithUniqueKey>(connection, executer, docSerializer, null, headerParser, querySerializer, null, null);
             ops.Delete(null, new SolrQuery("id:123"));
         });
 }
开发者ID:Cort01,项目名称:SolrNet,代码行数:28,代码来源:SolrOperationsTests.cs


示例12: DeleteByMultipleId

 public void DeleteByMultipleId()
 {
     var mocks = new MockRepository();
     var connection = mocks.StrictMock<ISolrConnection>();
     var headerParser = mocks.StrictMock<ISolrHeaderResponseParser>();
     var executer = mocks.StrictMock<ISolrQueryExecuter<TestDocumentWithUniqueKey>>();
     var docSerializer = mocks.StrictMock<ISolrDocumentSerializer<TestDocumentWithUniqueKey>>();
     var validationManager = mocks.StrictMock<IMappingValidator>();
     With.Mocks(mocks)
         .Expecting(() => {
             Expect.On(connection)
                 .Call(connection.Post("/update", "<delete><id>0</id><id>0</id></delete>"))
                 .Repeat.Once()
                 .Return(EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml"));
             Expect.On(headerParser)
                 .Call(headerParser.Parse(null))
                 .IgnoreArguments()
                 .Return(new ResponseHeader());
         })
         .Verify(() => {
             var basic = new SolrBasicServer<TestDocumentWithUniqueKey>(connection, executer, docSerializer, null, headerParser, null, null, null);
             var ops = new SolrServer<TestDocumentWithUniqueKey>(basic, new AttributesMappingManager(), validationManager);
             ops.Delete(new[] {
                     new TestDocumentWithUniqueKey(),
                     new TestDocumentWithUniqueKey(),
                 });
         });
 }
开发者ID:Cort01,项目名称:SolrNet,代码行数:28,代码来源:SolrOperationsTests.cs


示例13: CommitWithOptions2_WaitSearcher

 public void CommitWithOptions2_WaitSearcher()
 {
     var mocks = new MockRepository();
     var connection = mocks.StrictMock<ISolrConnection>();
     var headerParser = mocks.StrictMock<ISolrHeaderResponseParser>();
     var executer = mocks.StrictMock<ISolrQueryExecuter<TestDocumentWithoutUniqueKey>>();
     var docSerializer = mocks.StrictMock<ISolrDocumentSerializer<TestDocumentWithoutUniqueKey>>();
     With.Mocks(mocks)
         .Expecting(() => {
             Expect.On(connection)
                 .Call(connection.Post("/update", "<commit waitSearcher=\"false\" waitFlush=\"true\" />"))
                 .Repeat.Once()
                 .Return(EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml"));
             Expect.On(headerParser)
                 .Call(headerParser.Parse(null))
                 .IgnoreArguments()
                 .Return(new ResponseHeader());
         })
         .Verify(() => {
             var ops = new SolrBasicServer<TestDocumentWithoutUniqueKey>(connection, executer, docSerializer, null, headerParser, null, null, null);
             ops.Commit(new CommitOptions { WaitSearcher = false });
         });
 }
开发者ID:Cort01,项目名称:SolrNet,代码行数:23,代码来源:SolrOperationsTests.cs


示例14: FacetQuery

        public void FacetQuery()
        {
            var connection = new MSolrConnection();
            connection.get += (url, param) => {
                Assert.AreEqual("/select", url);
                var expectedParams = new Dictionary<string, string> {
                    {"q", ""},
                    {"rows", SolrQueryExecuter<TestDocumentWithUniqueKey>.ConstDefaultRows.ToString()},
                    {"facet", "true"},
                    {"facet.query", "id:1"},
                };
                Assert.AreElementsEqualIgnoringOrder(expectedParams, param);
                return EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml");
            };

            var querySerializer = new DefaultQuerySerializer(new DefaultFieldSerializer());
            var facetQuerySerializer = new DefaultFacetQuerySerializer(querySerializer, new DefaultFieldSerializer());
            var parser = new MSolrAbstractResponseParser<TestDocumentWithUniqueKey>();
            parser.parse &= x => x.Stub();
            var executer = new SolrQueryExecuter<TestDocumentWithUniqueKey>(parser, connection, querySerializer, facetQuerySerializer, null);
            var solr = new SolrBasicServer<TestDocumentWithUniqueKey>(connection, executer, null, null, null, null, null, null);
            var r = solr.Query(new SolrQuery(""), new QueryOptions {
                Facet = new FacetParameters {
                    Queries = new ISolrFacetQuery[] {
                        new SolrFacetQuery(new SolrQuery("id:1")),
                    },
                }
            });

            Assert.AreEqual(1, connection.get.Calls);
        }
开发者ID:rivuc,项目名称:SolrNet-1,代码行数:31,代码来源:SolrOperationsTests.cs


示例15: CommitWithOptions

 public void CommitWithOptions()
 {
     var mocks = new MockRepository();
     var connection = mocks.CreateMock<ISolrConnection>();
     var executer = mocks.CreateMock<ISolrQueryExecuter<TestDocumentWithoutUniqueKey>>();
     var docSerializer = mocks.CreateMock<ISolrDocumentSerializer<TestDocumentWithoutUniqueKey>>();
     With.Mocks(mocks)
         .Expecting(() => Expect.Call(connection.Post("/update", "<commit waitSearcher=\"true\" waitFlush=\"true\" />"))
                              .Repeat.Once()
                              .Return(null))
         .Verify(() => {
             var ops = new SolrBasicServer<TestDocumentWithoutUniqueKey>(connection, executer, docSerializer);
             ops.Commit(new WaitOptions());
         });
 }
开发者ID:osdezwart,项目名称:SolrNet,代码行数:15,代码来源:SolrOperationsTests.cs


示例16: FacetFieldQuery

 public void FacetFieldQuery()
 {
     var mocks = new MockRepository();
     var query = new Dictionary<string, string>();
     query["q"] = "*:*";
     query["facet"] = "true";
     query["facet.field"] = "cat";
     query["rows"] = "0";
     var connection = new MockConnection(query);
     var resultParser = mocks.StrictMock<ISolrQueryResultParser<TestDocumentWithUniqueKey>>();
     var mapper = mocks.StrictMock<IReadOnlyMappingManager>();
     var validationManager = mocks.StrictMock<IMappingValidator>();
     var docSerializer = mocks.StrictMock<ISolrDocumentSerializer<TestDocumentWithUniqueKey>>();
     With.Mocks(mocks).Expecting(() => {
         Expect.On(resultParser)
             .Call(resultParser.Parse(""))
             .IgnoreArguments()
             .Repeat.Once()
             .Return(new SolrQueryResults<TestDocumentWithUniqueKey> {
                 FacetFields = new Dictionary<string, ICollection<KeyValuePair<string, int>>> {
                     {
                         "cat", new List<KeyValuePair<string, int>> {
                             new KeyValuePair<string, int>("electronics", 5),
                             new KeyValuePair<string, int>("hard drive", 3),
                         }
                         }
                 }
             });
     }).Verify(() => {
         var querySerializer = new DefaultQuerySerializer(new DefaultFieldSerializer());
         var facetQuerySerializer = new DefaultFacetQuerySerializer(querySerializer, new DefaultFieldSerializer());
         var queryExecuter = new SolrQueryExecuter<TestDocumentWithUniqueKey>(resultParser, connection, querySerializer, facetQuerySerializer);
         var basicSolr = new SolrBasicServer<TestDocumentWithUniqueKey>(connection, queryExecuter, docSerializer, null, null, null, null, null);
         var solr = new SolrServer<TestDocumentWithUniqueKey>(basicSolr, mapper, validationManager);
         var r = solr.FacetFieldQuery(new SolrFacetFieldQuery("cat"));
         Assert.AreEqual(2, r.Count);
         Assert.AreEqual("electronics", r.First().Key);
     });
 }
开发者ID:Cort01,项目名称:SolrNet,代码行数:39,代码来源:SolrOperationsTests.cs


示例17: NullableDateTime

 public void NullableDateTime()
 {
     var mocks = new MockRepository();
     var connection = mocks.StrictMock<ISolrConnection>();
     var responseParser = mocks.DynamicMock<ISolrHeaderResponseParser>();
     var resultParser = mocks.StrictMock<ISolrQueryResultParser<TestDocWithNullable>>();
     var queryExecuter = new SolrQueryExecuter<TestDocWithNullable>(resultParser, connection, null, null);
     var mapper = new AttributesMappingManager();
     var docSerializer = new SolrDocumentSerializer<TestDocWithNullable>(mapper, new DefaultFieldSerializer());
     var validationManager = mocks.StrictMock<IMappingValidator>();
     var basicSolr = new SolrBasicServer<TestDocWithNullable>(connection, queryExecuter, docSerializer, null, responseParser, null, null, null);
     var solr = new SolrServer<TestDocWithNullable>(basicSolr, mapper, validationManager);
     string xml = null;
     With.Mocks(mocks)
         .Expecting(() => {
             Expect.On(connection)
                 .Call(connection.Post(null, null))
                 .IgnoreArguments()
                 .Do(new Writer(delegate(string u, string s) {
                     Console.WriteLine(s);
                     xml = s;
                     return EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml");
                 }));
         })
         .Verify(() => {
             solr.Add(new TestDocWithNullable());
             Assert.AreEqual("<add><doc /></add>", xml);
         });
 }
开发者ID:Cort01,项目名称:SolrNet,代码行数:29,代码来源:SolrOperationsTests.cs


示例18: DeleteByMultipleId

 public void DeleteByMultipleId()
 {
     var mocks = new MockRepository();
     var connection = mocks.CreateMock<ISolrConnection>();
     var executer = mocks.CreateMock<ISolrQueryExecuter<TestDocumentWithUniqueKey>>();
     var docSerializer = mocks.CreateMock<ISolrDocumentSerializer<TestDocumentWithUniqueKey>>();
     With.Mocks(mocks)
         .Expecting(() => Expect.Call(connection.Post("/update", "<delete><id>0</id><id>0</id></delete>"))
                              .Repeat.Once()
                              .Return(null))
         .Verify(delegate {
             var basic = new SolrBasicServer<TestDocumentWithUniqueKey>(connection, executer, docSerializer);
             var ops = new SolrServer<TestDocumentWithUniqueKey>(basic, new AttributesMappingManager());
             ops.Delete(new[] {
                 new TestDocumentWithUniqueKey(),
                 new TestDocumentWithUniqueKey(),
             });
         });
 }
开发者ID:osdezwart,项目名称:SolrNet,代码行数:19,代码来源:SolrOperationsTests.cs


示例19: OptimizeWithWaitOptions

 public void OptimizeWithWaitOptions()
 {
     var mocks = new MockRepository();
     var connection = mocks.StrictMock<ISolrConnection>();
     var headerParser = mocks.DynamicMock<ISolrHeaderResponseParser>();
     var executer = mocks.StrictMock<ISolrQueryExecuter<TestDocumentWithoutUniqueKey>>();
     var docSerializer = mocks.StrictMock<ISolrDocumentSerializer<TestDocumentWithoutUniqueKey>>();
     With.Mocks(mocks)
         .Expecting(() => Expect.On(connection)
             .Call(connection.Post("/update", "<optimize waitSearcher=\"true\" waitFlush=\"true\" />"))
             .Repeat.Once()
             .Return(EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml")))
         .Verify(() => {
             var ops = new SolrBasicServer<TestDocumentWithoutUniqueKey>(connection, executer, docSerializer, null, headerParser, null, null, null);
             ops.Optimize(new CommitOptions {WaitFlush = true, WaitSearcher = true});
         });
 }
开发者ID:Cort01,项目名称:SolrNet,代码行数:17,代码来源:SolrOperationsTests.cs


示例20: DeleteByQuery

 public void DeleteByQuery()
 {
     var connection = new MSolrConnection();
     connection.post += (url, content) => {
         Assert.AreEqual("/update", url);
         Assert.AreEqual("<delete><query>id:123</query></delete>", content);
         return EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml");
     };
     var headerParser = new MSolrHeaderResponseParser();
     headerParser.parse += _ => null;
     var querySerializer = new MSolrQuerySerializer();
     querySerializer.serialize += _ => "id:123";
     var ops = new SolrBasicServer<TestDocumentWithUniqueKey>(connection, null, null, null, headerParser, querySerializer, null, null);
     ops.Delete(null, new SolrQuery("id:123"));
     Assert.AreEqual(1, connection.post.Calls);
 }
开发者ID:rivuc,项目名称:SolrNet-1,代码行数:16,代码来源:SolrOperationsTests.cs



注:本文中的SolrBasicServer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SolrDocumentSerializer类代码示例发布时间:2022-05-24
下一篇:
C# SolidColorBrush类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap