typesense / typesense-instantsearch-adapter

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

FacetFilter in <Configure> not being applied to <Hits> #108

Closed mattoboard closed 2 years ago

mattoboard commented 2 years ago

Description

When setting up a facetFilter in the said filter is not applied to . Meaning the facets counts respect the filter. However the results from are not applying the filter in any way.

I included a 5 second zoom as it might be easier to see: https://www.loom.com/share/16a72c382af8476f99e2b6bf3f2a7bc8

I have also tried to set filter_by in additionalSearchParameters to no avail.

Thank you for any help!

Metadata

typesense-instantsearch-adapter@2.4.0 - using Hosted Search. Chrome/Mac OS

Configuration looks liike:

    <InstantSearch indexName="materials" searchClient={searchClient}>
        <Configure  facetFilters={['objectStatus:APPROVED']} />
        <SearchBox  />
        <RefinementList attribute="materialColor" />
        <Stats />
        <Hits />
    </InstantSearch>

JSON Respnose

searches: [{query_by: "name", prefix: "true", sort_by: "updatedAt:desc", highlight_full_fields: "name",…},…] 0: {query_by: "name", prefix: "true", sort_by: "updatedAt:desc", highlight_full_fields: "name",…} collection: "materials" facet_by: "materialColor" filter_by: "materialColor:=[Gray]" highlight_full_fields: "name" max_facet_values: 10 page: 1 prefix: "true" q: "" query_by: "name" sort_by: "updatedAt:desc" 1: {query_by: "name", prefix: "true", sort_by: "updatedAt:desc", highlight_full_fields: "name",…} collection: "materials" facet_by: "materialColor" filter_by: "objectStatus:=[APPROVED]" highlight_full_fields: "name" max_facet_values: 10 page: 1 per_page: 1 prefix: "true" q: "" query_by: "name" sort_by: "updatedAt:desc"

jasonbosco commented 2 years ago

@mattoboard Configure is only useful for specifying the initial search state. They get overridden once users click on items in the RefinementList.

Here's how to apply a filter to all searches: https://github.com/typesense/typesense-instantsearch-adapter/issues/17#issuecomment-828064282

mattoboard commented 2 years ago

Thank you, still having trouble but seems like more a of using the helper with reach instasearch. Does not appear to be related to the typesense adapter.