0

有人可以给我一个使用 PlainElastic.Net.Queries.MoreLikeThisQuery 类的示例吗?该文档不包含使用 QueryBase 类的示例。

4

2 回答 2

0

我想出了如何做到这一点:

var connection  = new ElasticConnection("localhost", 9200);
string command = new SearchCommand("index", "type");
SearchCommand searchCommand = new SearchCommand();
searchCommand.Analyzer("arabic");
QueryBuilder<MyType> builder = new QueryBuilder<MyType>();
builder.Query (q => q.MoreLikeThis(t=> t.LikText ("Text to search for")
.Analyzer("analyzer_name")));     
string queryText = builder.Build();
string result = connection.Get(command, queryText);
于 2013-05-13T18:46:36.287 回答
0

我联系了 Alexander Yegorov,他为 mlt 查询添加了两个示例:

https://gist.github.com/Yegoroff/5572590 https://gist.github.com/Yegoroff/5572496

非常感谢他。

于 2013-05-14T09:11:04.873 回答