Skip to content

How to use different presets with single index/collection? #224

Open
@dharmabumzee

Description

@dharmabumzee

Description

Hi 👋

I'm having some trouble figuring out how to use one index/collection and two presets. Multiple indices work great, and collectionSpecificSearchParameters is really handy for config override per collection, but I can't figure out how to map indexId to use different presets per Index widget.

Is this even possible?

Thanks for any help in advance 🤞

additionalSearchParameters: {
        preset,
        facet_by,
      },
collectionSpecificSearchParameters: {
        // This works
        [index]: {
          preset: 'Some preset',
        },
        // This doesn't, but is there a way to connect `indexId` with specific preset?
        "id-1": {
          preset: 'Preset for 1',
        },
        "id-2": {
          preset: 'Preset for 2',
        },
      },
     
<InstantSearch
      searchClient={client.searchClient}
      indexName={index}
      initialUiState={initialUiState}
      onStateChange={onStateChange}
    >
     <Index indexName={index} indexId="id-1">
       <Hits />
     </Index>
    
     <Index indexName={index} indexId="id-2">
       <Hits />
     </Index>
</InstantSearch>

Metadata

Typesense Version:

"react-instantsearch": "7.2.0"
"typesense-instantsearch-adapter": "2.7.1",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions