/ / NEST APIの引数定義の説明-C#、visual-studio-2010、elasticsearch、nest

NEST APIの引数定義を説明する - c#、visual-studio-2010、elasticsearch、nest

// Summary:
//     The text_phrase_prefix is the same as text_phrase, expect it allows for prefix
//     matches on the last term in the text

public QueryContainer MatchPhrasePrefix<T>(Func<MatchPhrasePrefixQueryDescriptor<T>, IMatchQuery> selector);

誰かが何を説明できますか Func<MatchPhrasePrefixQueryDescriptor<T>, IMatchQuery> ありますか?

回答:

回答№1は0

これは、デリゲート/メソッド/ラムダ式を引数として受け入れるメソッドであり、それ自体が MatchPhrasePrefixQueryDescriptor<T> 引数として IMatchQuery インスタンス。

それは流ofなAPIの一部です NEST、高レベルの.NET Elasticsearchクライアント。 クライアントは、流れるようなAPIとオブジェクト初期化構文の両方をサポートしています。 他の人が指摘しているように、この方法は汎用的です。 MatchPhrasePrefix<T>

使用する

public class Document
{
public string Property1 { get; set; }
}

var searchResponse = client.Search<Document>(s => s
.Query(q => q
.MatchPhrasePrefix(p => p
.Field(f => f.Property1)
.Query("Prefix phrase")
)
)
);