1 {"slug":"/references/utils/SearchUtils/classes/utils.SearchUtils.SearchFieldsSchema","title":"SearchFieldsSchema","frontmatter":{},"toc":[{"title":"Type parameters","id":"type-parameters","level":2},{"title":"constructor","id":"constructor","level":2},{"title":"Type Parameters","id":"constructor-type-parameters","level":3},{"title":"Parameters","id":"constructor-parameters","level":3},{"title":"Properties","id":"properties","level":2},{"title":"Methods","id":"methods","level":2},{"title":"isSearchFieldsSchema","id":"issearchfieldsschema","level":3},{"title":"Parameters","id":"issearchfieldsschema-parameters","level":4},{"title":"Returns","id":"issearchfieldsschema-returns","level":4},{"title":"toFields","id":"tofields","level":3},{"title":"Returns","id":"tofields-returns","level":4}],"blocks":[{"kind":"markdown","html":"A fields schema produced by `search.define(...)`. Compiles to plain\nSearchFieldDefinition records for the Search Module."},{"kind":"heading","level":2,"text":"Type parameters","id":"type-parameters"},{"kind":"typeList","sectionTitle":"SearchFieldsSchema","types":[{"name":"Schema","type":"[SearchSchema](/references/types/SearchTypes/types/types.SearchTypes.SearchSchema)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"$dataType","type":"T","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"$dataType","type":"T","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]},{"kind":"heading","level":2,"text":"constructor","id":"constructor"},{"kind":"heading","level":3,"text":"Type Parameters","id":"constructor-type-parameters"},{"kind":"typeList","sectionTitle":"constructor","types":[{"name":"Schema","type":"[SearchSchema](/references/types/SearchTypes/types/types.SearchTypes.SearchSchema)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"$dataType","type":"T","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"$dataType","type":"T","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]},{"kind":"heading","level":3,"text":"Parameters","id":"constructor-parameters"},{"kind":"typeList","sectionTitle":"constructor","types":[{"name":"schema","type":"Schema","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"kind":"heading","level":2,"text":"Properties","id":"properties"},{"kind":"typeList","sectionTitle":"SearchFieldsSchema","types":[{"name":"[IsSearchFieldsSchema]","type":"`boolean`","description":"","optional":false,"defaultValue":"true","expandable":false,"children":[]},{"name":"schema","type":"Schema","description":"The DSL schema. Public so document types can be inferred from it —\nsee InferSearchDocumentType.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"kind":"heading","level":2,"text":"Methods","id":"methods"},{"kind":"heading","level":3,"text":"isSearchFieldsSchema","id":"issearchfieldsschema"},{"kind":"heading","level":4,"text":"Parameters","id":"issearchfieldsschema-parameters"},{"kind":"typeList","sectionTitle":"isSearchFieldsSchema","types":[{"name":"value","type":"`unknown`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"kind":"heading","level":4,"text":"Returns","id":"issearchfieldsschema-returns"},{"kind":"typeList","sectionTitle":"isSearchFieldsSchema","types":[{"name":"value","type":"value is SearchFieldsSchema&#60;any&#62;","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]},{"kind":"heading","level":3,"text":"toFields","id":"tofields"},{"kind":"markdown","html":"Compile the DSL schema into plain SearchFieldDefinition records."},{"kind":"heading","level":4,"text":"Returns","id":"tofields-returns"},{"kind":"typeList","sectionTitle":"toFields","types":[{"name":"Record","type":"`Record<string, [SearchFieldDefinition](/references/types/SearchTypes/interfaces/types.SearchTypes.SearchFieldDefinition)>`","optional":false,"defaultValue":"","description":"Compile the DSL schema into plain SearchFieldDefinition records.","expandable":false,"children":[{"name":"string","type":"`string`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]},{"name":"SearchFieldDefinition","type":"[SearchFieldDefinition](/references/types/SearchTypes/interfaces/types.SearchTypes.SearchFieldDefinition)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"type","type":"[SearchFieldKind](/references/types/SearchTypes/types/types.SearchTypes.SearchFieldKind)","description":"The field's type.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"array","type":"`boolean`","description":"Whether the field holds an array of the declared `type`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"searchable","type":"`boolean` \\| `object`","description":"Whether the field is matched against a free-text query, optionally with a\n`weight` boosting its relevance. The weight is applied at build time on some\nengines, such as Meilisearch and Algolia, and at query time on others, such\nas Typesense and Elasticsearch.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"weight","type":"`number`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"filterable","type":"`boolean`","description":"Whether the field can be used in a query's filters.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"sortable","type":"`boolean`","description":"Whether results can be sorted by the field.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"facetable","type":"`boolean` \\| `object`","description":"Whether the field can be faceted, and which facet types it supports.\nDefaults to `[\"value\"]`, or `[\"range\"]` for numeric and date fields.\n`\"stats\"` is opt-in, since implying it would make numeric fields unusable on\nproviders without aggregations.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"types","type":"[SearchFacetKind](/references/types/SearchTypes/types/types.SearchTypes.SearchFacetKind)[]","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"retrievable","type":"`boolean`","description":"Whether the field comes back on hits. `false` for index-only fields, such as a\nblob used purely for matching. `query.search` reads this to decide which\nrequested fields the engine can serve and which need `query.graph`.\n\nVector fields default to not retrievable — embeddings are not useful on\nhits. Set `retrievable: true`, or `.retrievable()` in the DSL, to return\nthem.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"fields","type":"`Record<string, [SearchFieldDefinition](/references/types/SearchTypes/interfaces/types.SearchTypes.SearchFieldDefinition)>`","description":"The fields of a nested object, only used when `type` is `object`.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"type","type":"[SearchFieldKind](/references/types/SearchTypes/types/types.SearchTypes.SearchFieldKind)","description":"The field's type.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"array","type":"`boolean`","description":"Whether the field holds an array of the declared `type`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"searchable","type":"`boolean` \\| `object`","description":"Whether the field is matched against a free-text query, optionally with a\n`weight` boosting its relevance. The weight is applied at build time on some\nengines, such as Meilisearch and Algolia, and at query time on others, such\nas Typesense and Elasticsearch.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"filterable","type":"`boolean`","description":"Whether the field can be used in a query's filters.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"sortable","type":"`boolean`","description":"Whether results can be sorted by the field.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"facetable","type":"`boolean` \\| `object`","description":"Whether the field can be faceted, and which facet types it supports.\nDefaults to `[\"value\"]`, or `[\"range\"]` for numeric and date fields.\n`\"stats\"` is opt-in, since implying it would make numeric fields unusable on\nproviders without aggregations.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"retrievable","type":"`boolean`","description":"Whether the field comes back on hits. `false` for index-only fields, such as a\nblob used purely for matching. `query.search` reads this to decide which\nrequested fields the engine can serve and which need `query.graph`.\n\nVector fields default to not retrievable — embeddings are not useful on\nhits. Set `retrievable: true`, or `.retrievable()` in the DSL, to return\nthem.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"fields","type":"`Record<string, [SearchFieldDefinition](/references/types/SearchTypes/interfaces/types.SearchTypes.SearchFieldDefinition)>`","description":"The fields of a nested object, only used when `type` is `object`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"dimensions","type":"`number`","description":"The dimensionality of the embedding stored in a `type: \"vector\"` field.\nRequired for vector fields; meaningless on any other type. When `embed` is\nomitted, every vector written to the field must have exactly this many\ncomponents.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"embed","type":"`boolean`","description":"When `true` on a vector field, documents pass a string and the engine\nembeds it at write time, and for `search_options.vector.query` at query\ntime. Omit `embed` to supply embeddings yourself as a `number[]`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"provider_options","type":"`Record<string, Record&#60;string, unknown&#62;>`","description":"Field options specific to a search engine, keyed by provider identifier, such\nas `{ meilisearch: { ... } }`.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"dimensions","type":"`number`","description":"The dimensionality of the embedding stored in a `type: \"vector\"` field.\nRequired for vector fields; meaningless on any other type. When `embed` is\nomitted, every vector written to the field must have exactly this many\ncomponents.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"embed","type":"`boolean`","description":"When `true` on a vector field, documents pass a string and the engine\nembeds it at write time, and for `search_options.vector.query` at query\ntime. Omit `embed` to supply embeddings yourself as a `number[]`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"provider_options","type":"`Record<string, Record&#60;string, unknown&#62;>`","description":"Field options specific to a search engine, keyed by provider identifier, such\nas `{ meilisearch: { ... } }`.","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]}]}]}