{"record":{"id":"1a474e732ce3ee03","repo":"krisk/Fuse","slug":"extended-search-is-not-available","errorCode":null,"errorMessage":"Extended search is not available","messagePattern":"Extended search is not available","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/core/index.ts","lineNumber":76,"sourceCode":"  static use: (...plugins: any[]) => void\n  static match: (\n    pattern: string,\n    text: string,\n    options?: IFuseOptions<any>\n  ) => SearchResult\n\n  constructor(\n    docs: ReadonlyArray<T>,\n    options?: IFuseOptions<T>,\n    index?: FuseIndex<T>\n  ) {\n    this.options = { ...Config, ...options } as Required<IFuseOptions<T>>\n\n    if (\n      this.options.useExtendedSearch &&\n      !process.env.EXTENDED_SEARCH_ENABLED\n    ) {\n      throw new Error(ErrorMsg.EXTENDED_SEARCH_UNAVAILABLE)\n    }\n\n    if (this.options.useTokenSearch && !process.env.TOKEN_SEARCH_ENABLED) {\n      throw new Error(ErrorMsg.TOKEN_SEARCH_UNAVAILABLE)\n    }\n\n    this._keyStore = new KeyStore(this.options.keys)\n\n    this._docs = docs as T[]\n    this._myIndex = null as any\n    this._invertedIndex = null\n\n    this.setCollection(docs, index)\n\n    this._lastQuery = null\n    this._lastSearcher = null\n  }\n","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/krisk/Fuse/blob/edf2fb608eca0461508d1d71317e6e58309ffada/src/core/index.ts#L58-L94","documentation":"Fuse.js gates extended search (operator syntax like $contains, $eq) behind the EXTENDED_SEARCH_ENABLED environment variable so builds that don't need the feature can exclude it. If you construct a Fuse instance with useExtendedSearch: true while that env var is unset, the constructor throws immediately. This is an intentional opt-in contract, not a bug.","triggerScenarios":"Calling new Fuse(docs, { keys: [...], useExtendedSearch: true }) in a process where process.env.EXTENDED_SEARCH_ENABLED is unset or falsy at construction time.","commonSituations":".env files not loaded in the deployed environment; bundlers stripping env vars so the flag never reaches the client; copying a config with useExtendedSearch:true from a project that had the env var set.","solutions":["Set the environment variable EXTENDED_SEARCH_ENABLED to a truthy value ('1') before constructing Fuse.","Remove useExtendedSearch: true from options if operator syntax is not needed.","Ensure the env var is provisioned at build/runtime (dotenv, DefinePlugin, platform config) in every environment."],"exampleFix":"// before\nconst fuse = new Fuse(list, { keys: ['title'], useExtendedSearch: true })\n// after\nprocess.env.EXTENDED_SEARCH_ENABLED = '1'\nconst fuse = new Fuse(list, { keys: ['title'], useExtendedSearch: true })","handlingStrategy":"validation","validationCode":"if (options.useExtendedSearch && !process.env.EXTENDED_SEARCH_ENABLED) {\n  throw new Error('Set EXTENDED_SEARCH_ENABLED before using useExtendedSearch')\n}\nconst fuse = new Fuse(docs, options)","typeGuard":"const extendedSearchReady = () => Boolean(process.env.EXTENDED_SEARCH_ENABLED)","tryCatchPattern":"try {\n  return new Fuse(docs, options)\n} catch (e) {\n  if (e.message === 'Extended search is not available') {\n    process.env.EXTENDED_SEARCH_ENABLED = '1'\n    return new Fuse(docs, options)\n  }\n  throw e\n}","preventionTips":["Set EXTENDED_SEARCH_ENABLED in every environment (dev, CI, prod) before app bootstrap.","Centralize Fuse construction in a factory that asserts required env vars.","Never hardcode useExtendedSearch:true in shared config unless the flag is guaranteed."],"tags":["configuration","environment-variable","extended-search"],"backgroundTag":"missing-env-var","analyzedSha":"edf2fb608eca0461508d1d71317e6e58309ffada","analyzedAt":"2026-09-02T02:46:54.623Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}