SearchIndex.Fields Propiedad
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Obtiene o establece los campos del índice. Use FieldBuilder para definir campos basados en una clase de modelo, o SimpleField, SearchableFieldy ComplexField para definir manualmente campos. Los campos de índice tienen muchas restricciones que no se validan con SearchField hasta que se crea el índice en el servidor.
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)
Valor de propiedad
Ejemplos
Puede crear campos a partir de una clase de modelo mediante FieldBuilder:
SearchIndex index = new SearchIndex("hotels")
{
Fields = new FieldBuilder().Build(typeof(Hotel)),
Suggesters =
{
// Suggest query terms from the HotelName field.
new SearchSuggester("sg", "HotelName")
}
};
Por este motivo, Fields se puede establecer. En escenarios en los que el modelo no se conoce o no se puede modificar, también puede crear campos manualmente mediante clases auxiliares:
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")
}
};
Se aplica a
Azure SDK for .NET