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

How to generate customize query using React Instant Search widget? #116

Closed shejal-Hauper-fe closed 2 years ago

shejal-Hauper-fe commented 2 years ago

Description

I want to generate customize query as shown below:

{ "searches": [ { "query_by": "serverAddress", "sort_by": "", "highlight_full_fields": "serverAddress", "collection": "connections", "q": "10.9.91.27", "facet_by": "serverAddress", "max_facet_values": 100, "page": 1, "per_page": 100 } ] }

currently I am able to generate this type of query as shown in SS.

image

but I don't know how to customize it as per my requirement. Currently I'm using ConnectRefinementList with typesense client.

jasonbosco commented 2 years ago

You can configure Typesense parameters using the additionalServerParameters key when instantiating the adapter like this: https://github.com/typesense/typesense-instantsearch-adapter#with-instantsearchjs

shejal-Hauper-fe commented 2 years ago

Thanks for quick help but how to change value for filter_by as shown below: { "searches": [ { "query_by": "serverAddress", "sort_by": "", "highlight_full_fields": "serverAddress", "collection": "connections", "q": "*", "filter_by":"serverAddress:=10.89.51.44", "facet_by": "serverAddress", "max_facet_values": 100, "page": 1, "per_page": 100 } ] }

I'm getting this filter_by when I use facetFilters in component. But this is showing the value with an array but I don't want it to be in array. image

jasonbosco commented 2 years ago

The array syntax in filter_by also works with non-array fields. So this shouldn't throw an error.

shejal-Hauper-fe commented 2 years ago

Yes, it wouldn't throw any error but it doesn't allow user to trigger any query.

image

As you can see in the above image I've typed something but it is not triggering any query.

shejal-Hauper-fe commented 2 years ago

when we use facetFilters in component all the facet counts get zero.

jasonbosco commented 2 years ago

Could you put together a minimal example in codesandbox that replicates the issue? I can then help debug from there.