Replies: 1 comment
-
To get the parameters usable by a search client or browse, you can use the query that would be generated by algoliasearch-helper. To get access to that, get access to the search parameters, transform them to query parameters, and after that do what we want with it (maybe frontend, maybe backend, maybe search, maybe browse). import React from "react";
import { useInstantSearch } from "react-instantsearch";
import requestBuilder from "algoliasearch-helper/src/requestBuilder";
export function Exporter() {
const parameters = useInstantSearch();
return (
<button
type="button"
onClick={() => {
alert("see logs");
console.log(
requestBuilder._getHitsSearchParams(parameters.results._state)
);
}}
>
export current search parameters
</button>
);
} https://codesandbox.io/s/youthful-noyce-duygx3?file=/src/components/Exporter.tsx Note that this is private API, and may change without breaking change, so you could also copy the actual implementation subset you need in your case. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In the app I am building, users can opt to select and download all documents associated with the current search. When the search returns only a 10 or less results, this is easy because all the info I need is available in this hits. However, when the results span multiple pages, I don’t have access to the data I need to facilitate a “Download All.”
Was wondering then, can I programmatically get all hits so that I can get the information I need to implement this? That is, I need the get an array of Obj.file_name for each object in the search’s complete result set.
Beta Was this translation helpful? Give feedback.
All reactions