Get search request form data using React InstantSearch hook

I was wondering if there is a way to get the search request form data when using React InstantSearch hook. I am trying to get the faceFilters value from the search request and pass it in the browseObjects method. The closest data I was able to find was uiState from InstantSearch hook, but the data is not in the same format as the one sent in search request.

Thanks in advance!

My team was able to resolve this by using the query params in scopedResults from the useInstantSearch hook.

const [queryParams, setQueryParams] = useState();
const [query, setQuery] = useState("");
const { scopedResults } = useInstantSearch();

useEffect(() => {
	let res = scopedResults as any;
	//capture query
	//split params string and capture query params (includes all facet filters)
	let params = getQueryParams(res[0].results.params);
}, [scopedResults]);

Pass the params in browseObjects():

	query: query || "",
	facetFilters: queryParams ? queryParams["facetFilters"] : "",
	numericFilters: queryParams ? queryParams["numericFilters"] : "",
	batch: (batch: any) => {
		exportHits = exportHits.concat(batch);
1 Like