Skip to content

Commit

Permalink
Ability to specify collection specific facet options. #190
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonbosco committed Dec 20, 2023
1 parent ac9ebb2 commit edbf6b3
Show file tree
Hide file tree
Showing 13 changed files with 55 additions and 17 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -469,11 +469,16 @@ const typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({
brand: "(sort_by: _alpha:asc)",
category: "(sort_by: _alpha:desc)",
}, // <======= Add any facet_by parameter as a key value pair. Don't forget the surrounding parantheses in the value.
collectionSpecificFacetByOptions: {
collection1: {
brand: "(sort_by: _alpha:desc)",
},
}, // <======= Use this parameter if multiple collections share the same field names, and you want to use different options for each field. This will override facetByOptions for that particular collection.
additionalSearchParameters,
});
```

Note that for sorting in refinementLists, in addition to sorting on the Typesense Server-side, you'd also need to pass the [`sortBy`](https://www.algolia.com/doc/api-reference/widgets/refinement-list/js/#widget-param-sortby) parameter to the refinementList widget to also sort the results appropriately on the client-side.
Note that for sorting in refinementLists, in addition to sorting on the Typesense Server-side, you'd also need to pass the [`sortBy`](https://www.algolia.com/doc/api-reference/widgets/refinement-list/js/#widget-param-sortby) parameter to the refinementList widget to also sort the results appropriately on the client-side.
### Grouped Hits
Expand Down
14 changes: 10 additions & 4 deletions dist/typesense-instantsearch-adapter.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/typesense-instantsearch-adapter.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/typesense-instantsearch-adapter.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/typesense-instantsearch-adapter.min.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ interface BaseAdapterOptions {
renderingContent?: object;
flattenGroupedHits?: boolean;
facetByOptions?: object;
collectionSpecificFacetByOptions?: object;
}

interface CollectionSearchParameters {
Expand Down
4 changes: 3 additions & 1 deletion lib/Configuration.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/Configuration.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit edbf6b3

Please sign in to comment.