Search code examples
angularinstantsearchtypesense

Disable typos in algolia ais-refinement list search for facets


I am using algolia angular instantsearch and TypesenseInstantSearchAdapter. I've created custom ais-refinement list component and now stucked, because when i am searching inside facet list i get results with typos.1 I tried to add numTypos: 0 to serverSetting, this how it looks like:

this.typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({
  server: {
    apiKey: this.data.serverSettings.apikey,
    nodes: [
      {
        host: this.data.serverSettings.host,
        port: this.data.serverSettings.port,
        protocol: 'https',
      },
    ],
  },
  additionalSearchParameters: {
    queryBy: 'plaintexttitle',
    numTypos: 0,
  },
});
this.searchClient = this.typesenseInstantsearchAdapter.searchClient;

Also i've tried to add to config settings typoTolerance or exactOnSingleWordQuery, it didn't helped

  config:{
  indexName: this.data.indexName,
  searchClient: this.searchClient,
  attributesForFaceting: this.attributes,
  typoTolerance: false,
  exactOnSingleWordQuery: 'word'}

I don't, maybe i should add something to connect parameters, when i am creating refinement list?

 ngOnInit() {
this.createWidget(connectRefinementList, {
  // instance options
  attribute: this.attr,
  sortBy: this.defineSorting(this.sortBy),
  limit: 50,
});
super.ngOnInit();

}


Solution

  • Typesense server does not yet have a parameter for disabling typos for facet search https://github.com/typesense/typesense/issues/429