SearchIndex.Fields プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
インデックス内のフィールドを取得または設定します。 モデル クラスまたは SimpleField、SearchableFieldComplexField、 に基づいてフィールドを定義し、フィールドを手動で定義するには、 を使用FieldBuilderします。 インデックス フィールドには、サーバーで SearchField インデックスが作成されるまで検証されない制約が多数あります。
public System.Collections.Generic.IList<Azure.Search.Documents.Indexes.Models.SearchField> Fields { get; set; }
member this.Fields : System.Collections.Generic.IList<Azure.Search.Documents.Indexes.Models.SearchField> with get, set
Public Property Fields As IList(Of SearchField)
プロパティ値
例
を使用して、モデル クラスからフィールドを FieldBuilder作成できます。
SearchIndex index = new SearchIndex("hotels")
{
Fields = new FieldBuilder().Build(typeof(Hotel)),
Suggesters =
{
// Suggest query terms from the HotelName field.
new SearchSuggester("sg", "HotelName")
}
};
このため、 Fields は設定可能です。 モデルが不明または変更できないシナリオでは、ヘルパー クラスを使用してフィールドを手動で作成することもできます。
SearchIndex index = new SearchIndex("hotels")
{
Fields =
{
new SimpleField("HotelId", SearchFieldDataType.String) { IsKey = true, IsFilterable = true, IsSortable = true },
new SearchableField("HotelName") { IsFilterable = true, IsSortable = true },
new SearchableField("Description") { AnalyzerName = LexicalAnalyzerName.EnLucene },
new SearchableField("Tags", collection: true) { IsFilterable = true, IsFacetable = true },
new ComplexField("Address")
{
Fields =
{
new SearchableField("StreetAddress"),
new SearchableField("City") { IsFilterable = true, IsSortable = true, IsFacetable = true },
new SearchableField("StateProvince") { IsFilterable = true, IsSortable = true, IsFacetable = true },
new SearchableField("Country") { IsFilterable = true, IsSortable = true, IsFacetable = true },
new SearchableField("PostalCode") { IsFilterable = true, IsSortable = true, IsFacetable = true }
}
}
},
Suggesters =
{
// Suggest query terms from the hotelName field.
new SearchSuggester("sg", "HotelName")
}
};
適用対象
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
Azure SDK for .NET