1 {"slug":"/references/utils/SearchUtils/interfaces/utils.SearchUtils.SearchGraphSourceOptions","title":"SearchGraphSourceOptions","frontmatter":{},"toc":[{"title":"Type parameters","id":"type-parameters","level":2},{"title":"Properties","id":"properties","level":2}],"blocks":[{"kind":"heading","level":2,"text":"Type parameters","id":"type-parameters"},{"kind":"typeList","sectionTitle":"SearchGraphSourceOptions","types":[{"name":"Fields","type":"[SearchIndexFieldsInput](/references/types/SearchTypes/types/types.SearchTypes.SearchIndexFieldsInput)","description":"Input accepted by \n\n`defineSearchIndex`\n\n for the \n\n`fields`\n\n property — a\nschema from \n\n`search.define({ ... })`\n\n.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"TRow","type":"[GraphRow](/references/utils/types/utils.GraphRow)","description":"`seed`\n\n and \n\n`consume`\n\n implementations backed by \n\n`query.graph`\n\n.\n\nNearly every index is a projection of an entity that already lives behind\n\n\n`query.graph`\n\n, so the helpers simplify catchup, soft-deletes and similar,\nwhich should be enough for most use cases.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"kind":"heading","level":2,"text":"Properties","id":"properties"},{"kind":"typeList","sectionTitle":"SearchGraphSourceOptions","types":[{"name":"entity","type":"`string`","description":"The `query.graph` entrypoint to read from. Defaults to the index\ndefinition's `entity`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"fields","type":"`string`[]","description":"The fields to select from `query.graph`. Without a `transform` the row is\nindexed as-is, so this should then select exactly what the index declares.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"context","type":"[SearchGraphQueryContext](/references/utils/SearchUtils/types/utils.SearchUtils.SearchGraphQueryContext)","description":"The query context `query.graph` reads the rows with, e.g. the pricing\ncontext `variants.calculated_price` needs. Applied to seed, catch-up and\n`consume` alike.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"transform","type":"(`rows`: TRow[], `context`: [SearchIngestionContext](/references/types/SearchTypes/interfaces/types.SearchTypes.SearchIngestionContext)) => [InferSearchDocumentType](/references/types/SearchTypes/types/types.SearchTypes.InferSearchDocumentType)<Fields>[] \\| Promise<[InferSearchDocumentType](/references/types/SearchTypes/types/types.SearchTypes.InferSearchDocumentType)<Fields>[]>","description":"Maps a page of rows to the documents to index, e.g. `rows.map(toDocument)`.\nAsync, and handed the whole page, so reads `query.graph` cannot make in\none pass — prices in several currencies, say — cost a fixed number of\nqueries per page. Every document must carry the row's primary key value\nas `id`; a row with no document is excluded, which `consume` and the\ncatch-up pass turn into a delete so it leaves the index rather than\ngoing stale in it.\n\nDefaults to indexing the rows as-is.","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]}