本文整理汇总了C#中SolrBasicServer.Optimize方法的典型用法代码示例。如果您正苦于以下问题:C# SolrBasicServer.Optimize方法的具体用法?C# SolrBasicServer.Optimize怎么用?C# SolrBasicServer.Optimize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SolrBasicServer
的用法示例。
在下文中一共展示了SolrBasicServer.Optimize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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});
});
}
示例2: OptimizeWithWaitOptions
public void OptimizeWithWaitOptions()
{
var connection = new MSolrConnection();
connection.post += (url, content) => {
Assert.AreEqual("/update", url);
Assert.AreEqual("<optimize waitSearcher=\"true\" waitFlush=\"true\" />", content);
return EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml");
};
var headerParser = new MSolrHeaderResponseParser();
headerParser.parse += _ => null;
var ops = new SolrBasicServer<TestDocumentWithoutUniqueKey>(connection, null, null, null, headerParser, null, null, null);
ops.Optimize(new CommitOptions { WaitFlush = true, WaitSearcher = true });
}
示例3: OptimizeWithWaitOptions
public void OptimizeWithWaitOptions()
{
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", "<optimize waitSearcher=\"true\" waitFlush=\"true\" />"))
.Repeat.Once()
.Return(null))
.Verify(() => {
var ops = new SolrBasicServer<TestDocumentWithoutUniqueKey>(connection, executer, docSerializer);
ops.Optimize(new WaitOptions {WaitFlush = true, WaitSearcher = true});
});
}
示例4: Optimize
public void Optimize()
{
var connection = new MSolrConnection();
connection.post += (url, content) => {
Assert.AreEqual("/update", url);
Assert.AreEqual("<optimize />", content);
return EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml");
};
var headerParser = new MSolrHeaderResponseParser();
headerParser.parse += _ => null;
var ops = new SolrBasicServer<TestDocumentWithoutUniqueKey>(connection, null, null, null, headerParser, null, null, null);
ops.Optimize(null);
Assert.AreEqual(1, connection.post.Calls);
}