typesense / typesense-instantsearch-adapter

A JS adapter library to build rich search interfaces with Typesense and InstantSearch.js
MIT License
402 stars 63 forks source link

facetByOptions per collection, rather than universally #190

Closed pixelmaven closed 9 months ago

pixelmaven commented 9 months ago

Description

I have two indexes that share a field name, but would like to sort the facets in one and not the other. Currently I can set this globally in the typesense adapter config.

Perhaps this should be treated similarly to collectionSpecificSearchParameters instead, to allow for collection specific facetByOptions configuration.

Steps to reproduce

facetByOptions: {
    brand: '(sort_by: _alpha:asc)',
},

Expected Behavior

collectionSpecificFacetByOptions: {
    products: {
        brand: '(sort_by: _alpha:asc)',
    }.
},

Actual Behavior

Globally configured/sorted facet lists, rather than collection specific.

Metadata

Typesense Version: typesense/typesense:0.26.0.rc41 typesense-instantsearch-adapter@2.8.0-1 typesense@1.7.2

jasonbosco commented 9 months ago

@pixelmaven Just added the ability to specify collectionSpecificFacetByOptions in v2.8.0-4. Could you give it a shot and let me know how it goes?

pixelmaven commented 9 months ago

@jasonbosco Looks good on my end, thanks!

jasonbosco commented 9 months ago

Awesome, thank you for confirming and thank you for catching this!