{"record":{"id":"1749fca675155388","repo":"medusajs/medusa","slug":"message-1749fc","errorCode":null,"errorMessage":"${message}","messagePattern":"\\$\\{message\\}","errorType":"validation","errorClass":"MedusaError","httpStatus":400,"severity":"error","filePath":"packages/modules/search/src/providers/search-medusa/utils/plan.ts","lineNumber":38,"sourceCode":"\nexport type TypoToleranceSettings = {\n  enabled: boolean\n  min_word_size_for_one_typo: number\n  min_word_size_for_two_typos: number\n  disabled_on_attributes: Set<string>\n}\n\nexport type IndexPlan = {\n  fields: Map<string, PlannedField>\n  schema: Record<string, AttributeSchema>\n  searchable: string[]\n  primary_key: string\n  options: MedusaSearchIndexOptions\n  typo_tolerance: TypoToleranceSettings\n}\n\nfunction fail(message: string): never {\n  throw new MedusaError(MedusaError.Types.NOT_ALLOWED, message)\n}\n\n// Inspired by Meilisearch's own typo-tolerance defaults.\nconst DEFAULT_MIN_WORD_SIZE_FOR_ONE_TYPO = 5\nconst DEFAULT_MIN_WORD_SIZE_FOR_TWO_TYPOS = 9\n\nfunction resolveTypoTolerance(\n  settings: SearchTypes.SearchIndexSettings\n): TypoToleranceSettings {\n  const typo = settings.typo_tolerance\n  return {\n    enabled: typo?.enabled ?? true,\n    min_word_size_for_one_typo:\n      typo?.min_word_size_for_one_typo ?? DEFAULT_MIN_WORD_SIZE_FOR_ONE_TYPO,\n    min_word_size_for_two_typos:\n      typo?.min_word_size_for_two_typos ?? DEFAULT_MIN_WORD_SIZE_FOR_TWO_TYPOS,\n    disabled_on_attributes: new Set(typo?.disabled_on_attributes ?? []),\n  }","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/modules/search/src/providers/search-medusa/utils/plan.ts#L20-L56","documentation":"This is the index-plan error channel (plan.ts fail()): fieldType, assertIndexSupported, and toSearchDocument throw NOT_ALLOWED for index definitions the provider cannot build. Concrete rejections: vector fields declared as arrays or without positive dimensions, geo fields, unsupported field types, correlated array predicates, synonyms, and custom stop-word lists.","triggerScenarios":"Creating or loading a search index whose definition includes settings.synonyms, non-empty settings.stop_words, a field with type \"geo\", a vector field missing/duplicating dimensions, a correlated field, or any type outside keyword/text/integer/float/boolean/date/vector/object.","commonSituations":"Porting an index definition from Meilisearch (synonyms and stop words are common there) to the Medusa search provider; enabling geo filtering that this provider doesn't support; mis-declared vector (embedding) fields when adding semantic search.","solutions":["Remove synonyms and custom stop_words from the index settings","Drop or replace geo fields (not supported by this provider)","Fix vector fields: not array, with explicit positive dimensions (e.g. dimensions: 1536)","Remove correlated: true from array fields or restructure the schema so predicates don't need per-element correlation"],"exampleFix":"// before\nconst settings = {\n  synonyms: { phone: [\"smartphone\"] },\n  stop_words: [\"the\", \"a\"],\n}\n// after\nconst settings = {\n  typo_tolerance: { enabled: true }, // supported settings only\n}\n","handlingStrategy":"validation","validationCode":"const SUPPORTED_TYPES = new Set([\"keyword\",\"text\",\"integer\",\"float\",\"boolean\",\"date\",\"vector\",\"object\"])\nfunction isIndexSupported(def) {\n  if (def.settings?.synonyms) return false\n  if (def.settings?.stop_words?.length) return false\n  return Object.values(def.fields).every((f) =>\n    f.type === \"geo\" || f.correlated ? false : SUPPORTED_TYPES.has(f.type)\n  )\n}","typeGuard":"const isSupportedFieldType = (t) =>\n  [\"keyword\",\"text\",\"integer\",\"float\",\"boolean\",\"date\",\"vector\",\"object\"].includes(t)","tryCatchPattern":"try { await createIndex(def) } catch (e) { if (e instanceof MedusaError && e.type === \"not_allowed\") { /* surface config error to operator: e.message says exactly which setting/field */ } throw e }","preventionTips":["Don't copy Meilisearch settings verbatim; drop synonyms and stop_words","Declare vector fields with explicit dimensions and never as arrays","Run a config lint on index definitions in CI before deploying search settings"],"tags":["search","index-definition","unsupported-feature","schema-validation"],"backgroundTag":"unsupported-index-setting","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}