typesense-instantsearch-adapter 2.10.0-0 → 3.0.0-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,7 +5,7 @@ An adapter to use the awesome [Instantsearch.js](https://github.com/algolia/inst
5
5
  [![NPM version][npm-image]][npm-url]
6
6
  ![downloads](https://img.shields.io/npm/dt/typesense-instantsearch-adapter?label=downloads)
7
7
 
8
- Here is an example of UI you can build with this adapater: [songs-search.typesense.org](https://songs-search.typesense.org)
8
+ Here is an example of UI you can build with this adapter: [songs-search.typesense.org](https://songs-search.typesense.org)
9
9
 
10
10
  **Note:** If your search interface is built on a custom autocomplete component, or is based on [@algolia/autocomplete-js](https://www.algolia.com/doc/ui-libraries/autocomplete/introduction/what-is-autocomplete/), then you don't need this adapter to use it with Typesense, as [typesense-js](https://github.com/typesense/typesense-js) library already supports client-side fetching data from any async data sources. Read more [here](https://github.com/typesense/typesense-instantsearch-adapter/issues/88#issuecomment-1021597634).
11
11
 
@@ -510,7 +510,7 @@ const typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({
510
510
  facetByOptions: {
511
511
  brand: "(sort_by: _alpha:asc)",
512
512
  category: "(sort_by: _alpha:desc)",
513
- }, // <======= Add any facet_by parameter as a key value pair. Don't forget the surrounding parantheses in the value.
513
+ }, // <======= Add any facet_by parameter as a key value pair. Don't forget the surrounding parentheses in the value.
514
514
  collectionSpecificFacetByOptions: {
515
515
  collection1: {
516
516
  brand: "(sort_by: _alpha:desc)",
@@ -557,6 +557,41 @@ const typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({
557
557
  });
558
558
  ```
559
559
 
560
+ ### Flipping negative refinement operators
561
+
562
+ By default, excluded values from `refinementList` are encoded as list filters,
563
+ like `field:![a,b]`, while included OR values are encoded as `field:[a,b]`.
564
+
565
+ If you want to flip how negative refinements are encoded, set
566
+ `flipNegativeRefinementOperator: true`:
567
+
568
+ ```js
569
+ const typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({
570
+ server: {
571
+ apiKey: "xyz",
572
+ nodes: [
573
+ {
574
+ host: "localhost",
575
+ port: "8108",
576
+ path: "/",
577
+ protocol: "http",
578
+ },
579
+ ],
580
+ },
581
+ flipNegativeRefinementOperator: true,
582
+ additionalSearchParameters,
583
+ });
584
+ ```
585
+
586
+ With this option enabled:
587
+
588
+ - `operator: "and"` with negative values is merged as:
589
+ `field:![a,b]`
590
+ - `operator: "or"` with negative values is expanded as:
591
+ `(field:!a || field:!b)`
592
+ - positive OR behavior is unchanged:
593
+ `field:[a,b]`
594
+
560
595
  ### Disabling overrides for certain sorts
561
596
 
562
597
  > Available as of typesense-instantsearch-adapter `2.9.0-0`