你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Field 类

定义

表示索引定义中的字段,该字段描述字段的名称、数据类型和搜索行为。 https://docs.microsoft.com/rest/api/searchservice/Create-Index

public class Field
type Field = class
Public Class Field
继承
Field

构造函数

Field(String, AnalyzerName)

使用必需的参数初始化新的可搜索字符串 Field。

Field(String, DataType)

使用必需的参数初始化新的简单字段。

Field(String, DataType, AnalyzerName)

使用必需的参数初始化新的可搜索简单字段。

Field(String, DataType, IList<Field>)

使用必需的参数初始化新的复杂字段。

属性

Analyzer

获取或设置要用于字段的语言分析器的名称。 此选项只能用于可搜索字段,并且无法与 searchAnalyzer 或 indexAnalyzer 一起设置。 选择分析器后,无法为字段更改它。 对于复杂字段,必须为 null。 可能的值包括:“ar.microsoft”、“ar.lucene”、“hy.lucene”、 'bn.microsoft', 'eu.lucene', 'bg.microsoft', 'bg.lucene', 'ca.microsoft', 'ca.lucene', 'zh-Hans.microsoft', 'zh-Hans.lucene', 'zh-Hant.microsoft', 'hr.microsoft', 'cs.microsoft', 'cs.lucene', 'da.microsoft', 'da.lucene', 'nl.microsoft', 'nl.lucene', 'en.microsoft', 'en.lucene', 'et.microsoft', 'fi.microsoft', 'fi.lucene', 'fr.microsoft', 'fr.lucene', 'gl.lucene', 'de.microsoft', 'de.lucene',el.microsoft', 'el.lucene', 'gu.microsoft', 'he.microsoft', 'hi.microsoft', 'hi.lucene', 'hu.microsoft', 'hu.lucene', 'is.microsoft', 'id.microsoft', 'id.lucene', 'ga.lucene', 'it.microsoft', 'it.lucene', 'ja.lucene', 'ko.microsoft', 'ko.lucene', 'lv.microsoft', 'lv.lucene', 'lt.microsoft', 'ml.microsoft', 'ms.microsoft', 'mr.microsoft', 'nb.microsoft', 'no.lucene', 'fa.lucene', 'pl.microsoft', 'pl.lucene', 'pt-BR.microsoft', 'pt-BR.lucene',pt-PT.microsoft,'pt-PT.lucene', 'pa.microsoft', 'ro.microsoft', 'ro.lucene', 'ru.microsoft', 'ru.lucene', 'sr-cyrillic.microsoft', 'sr-latin.microsoft', 'sk.microsoft', 'sl.microsoft', 'es.microsoft', 'es.lucene', 'sv.microsoft', 'sv.lucene', 'ta.microsoft', 'te.microsoft', 'th.microsoft', 'th.lucene', 'tr.microsoft', 'tr.lucene', 'uk.microsoft', 'your.microsoft', 'vi.microsoft', 'standard.lucene', 'standardasciifolding.lucene', '关键字 (keyword) ', 'pattern', 'simple', 'stop', 'whitespace'

Fields

如果这是类型为 Edm.ComplexType 或 Collection 的字段 (Edm.ComplexType) ,则获取或设置子字段的列表。 对于简单字段,必须为 null 或空。

IndexAnalyzer

获取或设置在为字段编制索引时使用的分析器的名称。 此选项只能与可搜索字段一起使用。 它必须与 searchAnalyzer 一起设置,并且不能与分析器选项一起设置。 选择分析器后,无法为字段更改它。 对于复杂字段,必须为 null。 可能的值包括:“ar.microsoft”、“ar.lucene”、“hy.lucene”、 'bn.microsoft', 'eu.lucene', 'bg.microsoft', 'bg.lucene', 'ca.microsoft', 'ca.lucene', 'zh-Hans.microsoft', 'zh-Hans.lucene', 'zh-Hant.microsoft', 'hr.microsoft', 'cs.microsoft', 'cs.lucene', 'da.microsoft', 'da.lucene', 'nl.microsoft', 'nl.lucene', 'en.microsoft', 'en.lucene', 'et.microsoft', 'fi.microsoft', 'fi.lucene', 'fr.microsoft', 'fr.lucene', 'gl.lucene', 'de.microsoft', 'de.lucene',el.microsoft', 'el.lucene', 'gu.microsoft', 'he.microsoft', 'hi.microsoft', 'hi.lucene', 'hu.microsoft', 'hu.lucene', 'is.microsoft', 'id.microsoft', 'id.lucene', 'ga.lucene', 'it.microsoft', 'it.lucene', 'ja.lucene', 'ko.microsoft', 'ko.lucene', 'lv.microsoft', 'lv.lucene', 'lt.microsoft', 'ml.microsoft', 'ms.microsoft', 'mr.microsoft', 'nb.microsoft', 'no.lucene', 'fa.lucene', 'pl.microsoft', 'pl.lucene', 'pt-BR.microsoft', 'pt-BR.lucene',pt-PT.microsoft,'pt-PT.lucene', 'pa.microsoft', 'ro.microsoft', 'ro.lucene', 'ru.microsoft', 'ru.lucene', 'sr-cyrillic.microsoft', 'sr-latin.microsoft', 'sk.microsoft', 'sl.microsoft', 'es.microsoft', 'es.lucene', 'sv.microsoft', 'sv.lucene', 'ta.microsoft', 'te.microsoft', 'th.microsoft', 'th.lucene', 'tr.microsoft', 'tr.lucene', 'uk.microsoft', 'your.microsoft', 'vi.microsoft', 'standard.lucene', 'standardasciifolding.lucene', '关键字 (keyword) ', 'pattern', 'simple', 'stop', 'whitespace'

IsFacetable

获取或设置一个值,该值指示是否启用在分面查询中引用的字段。 通常用于搜索结果的呈现,包括按类别 (的命中计数,例如,搜索数码相机并查看按品牌、按百万像素、按价格等) 命中数。 对于复杂字段,此属性必须为 null。 类型为 Edm.GeographyPoint 或 Collection (Edm.GeographyPoint) 的字段不可分面。 所有其他简单字段都是可分面的。 简单字段的默认值为 false,复杂字段的默认值为 null。

IsFilterable

获取或设置一个值,该值指示是否启用要在$filter查询中引用的字段。 filterable 与可搜索字符串的处理方式不同。 可筛选的 Edm.String 或集合 (Edm.String) 的字段不会进行断字,因此比较仅用于完全匹配。 例如,如果将此类字段 f 设置为“sunny day”,$filter=f eq 'sunny' 将找不到匹配项,但$filter=f eq 'sunny day' 将找到匹配项。 对于复杂字段,此属性必须为 null。 对于简单字段,默认值为 false,对于复杂字段,默认值为 null。

IsKey

获取或设置一个值,该值指示字段是否唯一标识索引中的文档。 必须选择每个索引中的一个顶级字段作为键字段,并且该字段的类型必须为 Edm.String。 关键字段可用于直接查找文档以及更新或删除特定文档。 对于简单字段,默认值为 false,对于复杂字段,默认值为 null。

IsRetrievable

获取或设置一个值,该值指示是否可以在搜索结果中返回字段。 如果要使用字段 (例如边距) 作为筛选器、排序或评分机制,但不希望字段对最终用户可见,则可以禁用此选项。 对于键字段,此属性必须为 true,对于复杂字段,此属性必须为 null。 可以在现有字段上更改此属性。 启用此属性不会导致索引存储要求的任何增加。 对于简单字段,默认值为 true,对于复杂字段,默认值为 null。

IsSearchable

获取或设置一个值,该值指示字段是否可全文搜索。 这意味着它会在索引期间受到分词之类的分析。 如果将某个可搜索字段设置为“sunny day”之类的值,在内部它将拆分为单独的标记“sunny”和“day”。 这实现了对这些词的全文搜素。 此属性只能设置为 true 类型为 Edm.String 或集合 (Edm.String) ,对于复杂字段必须为 null。 对于简单字段,默认值为 false,对于复杂字段,默认值为 null。 注意:可搜索字段会占用索引中的额外空间,因为Azure 认知搜索将存储字段值的其他标记化版本,以便进行全文搜索。 如果要节省索引中的空间,并且不需要字段包含在搜索中,请将“可搜索”设置为 false。

IsSortable

获取或设置一个值,该值指示是否启用要在$orderby表达式中引用的字段。 默认情况下,Azure 认知搜索按分数对结果进行排序,但在许多情况下,用户需要按文档中的字段进行排序。 仅当简单字段为单值 (它在父文档) 范围内具有单个值时,才能对其进行排序。 简单集合字段不可排序,因为它们是多值字段。 复杂集合的简单子字段也是多值字段,因此无法排序。 无论是直接父字段还是上级字段(即复杂集合),都是如此。 复杂字段不能排序,并且此类字段的可排序属性必须为 null。 对于简单字段,sortable 的默认值为 false,对于复杂字段,默认值为 null。

Name

获取或设置字段的名称,该名称在索引字段或父字段的字段集合中必须是唯一的。

SearchAnalyzer

获取或设置在搜索时用于字段的分析器的名称。 此选项只能与可搜索字段一起使用。 它必须与 indexAnalyzer 一起设置,并且不能与分析器选项一起设置。 此分析器无法在现有字段上更新。 对于复杂字段,必须为 null。 可能的值包括:“ar.microsoft”、“ar.lucene”、“hy.lucene”、 'bn.microsoft', 'eu.lucene', 'bg.microsoft', 'bg.lucene', 'ca.microsoft', 'ca.lucene', 'zh-Hans.microsoft', 'zh-Hans.lucene', 'zh-Hant.microsoft', 'hr.microsoft', 'cs.microsoft', 'cs.lucene', 'da.microsoft', 'da.lucene', 'nl.microsoft', 'nl.lucene', 'en.microsoft', 'en.lucene', 'et.microsoft', 'fi.microsoft', 'fi.lucene', 'fr.microsoft', 'fr.lucene', 'gl.lucene', 'de.microsoft', 'de.lucene',el.microsoft', 'el.lucene', 'gu.microsoft', 'he.microsoft', 'hi.microsoft', 'hi.lucene', 'hu.microsoft', 'hu.lucene', 'is.microsoft', 'id.microsoft', 'id.lucene', 'ga.lucene', 'it.microsoft', 'it.lucene', 'ja.lucene', 'ko.microsoft', 'ko.lucene', 'lv.microsoft', 'lv.lucene', 'lt.microsoft', 'ml.microsoft', 'ms.microsoft', 'mr.microsoft', 'nb.microsoft', 'no.lucene', 'fa.lucene', 'pl.microsoft', 'pl.lucene', 'pt-BR.microsoft', 'pt-BR.lucene',pt-PT.microsoft,'pt-PT.lucene', 'pa.microsoft', 'ro.microsoft', 'ro.lucene', 'ru.microsoft', 'ru.lucene', 'sr-cyrillic.microsoft', 'sr-latin.microsoft', 'sk.microsoft', 'sl.microsoft', 'es.microsoft', 'es.lucene', 'sv.microsoft', 'sv.lucene', 'ta.microsoft', 'te.microsoft', 'th.microsoft', 'th.lucene', 'tr.microsoft', 'tr.lucene', 'uk.microsoft', 'your.microsoft', 'vi.microsoft', 'standard.lucene', 'standardasciifolding.lucene', '关键字 (keyword) ', 'pattern', 'simple', 'stop', 'whitespace'

SynonymMaps

获取或设置要与此字段关联的同义词映射的名称列表。 此选项只能与可搜索字段一起使用。 目前,每个字段仅支持一个同义词映射。 将同义词映射分配给字段可确保在查询时使用同义词映射中的规则扩展面向该字段的查询词。 可以在现有字段上更改此属性。 对于复杂字段,必须为 null 或空集合。

Type

获取或设置字段的数据类型。 可能的值包括:“Edm.String”、“Edm.Int32”、“Edm.Int64”、“Edm.Double”、“Edm.Boolean”、“Edm.DateTimeOffset”、“Edm.GeographyPoint”、“Edm.ComplexType”

方法

New(String, DataType, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Nullable<AnalyzerName>, Nullable<AnalyzerName>, Nullable<AnalyzerName>, IList<String>)

创建一个具有必需参数的新简单字段。

NewComplex(String, Boolean, IList<Field>)

创建具有必需参数的新复杂字段。

NewSearchableCollection(String, AnalyzerName, Boolean, Boolean, Boolean, Boolean, IList<String>)

创建具有必需参数的新可搜索字符串集合 Field。

NewSearchableString(String, AnalyzerName, Boolean, Boolean, Boolean, Boolean, Boolean, IList<String>)

创建具有必需参数的新可搜索字符串 Field。

Validate()

验证 对象。

适用于