-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type error in searchOptions["facets"] which should also accept string
#1432
Comments
Normally facets gets casted back to an array in all/almost all use cases, which is why it's an array in these types here. Where is it a string for you? it looks like the issue may slightly be incomplete |
string
string
string
string
Hey @Haroenv , thanks for the quick reply. I'm going to check with |
I added a console.log here: algoliasearch-client-javascript/packages/client-search/src/methods/client/multipleQueries.ts Lines 11 to 35 in ba59b68
These are my filters: This is what appears in my console: [
{
"indexName": "movies",
"params": {
"facetFilters": [
[
"genres:Action"
]
],
"facets": [
"genres"
],
"highlightPostTag": "</ais-highlight-0000000000>",
"highlightPreTag": "<ais-highlight-0000000000>",
"maxValuesPerFacet": 10,
"query": "",
"tagFilters": ""
}
},
{
"indexName": "movies",
"params": {
"analytics": false,
"clickAnalytics": false,
"facets": "genres",
"highlightPostTag": "</ais-highlight-0000000000>",
"highlightPreTag": "<ais-highlight-0000000000>",
"hitsPerPage": 0,
"maxValuesPerFacet": 10,
"page": 0,
"query": ""
}
}
] This is my instantsearch setup: import algoliasearch from "algoliasearch";
import {
InstantSearch,
SearchBox,
Hits,
Highlight,
RefinementList
} from "react-instantsearch-dom";
const searchClient = algoliasearch("x","x");
const Hit = ({ hit }: { hit: Record<string, any> }) => {
return (
<div key={hit.id}>
<div className="hit-name">
<Highlight attribute="title" hit={hit} />
</div>
</div>
);
};
export default function App() {
return (
<InstantSearch searchClient={searchClient} indexName="movies">
<RefinementList attribute="genres" />
<SearchBox />
<Hits hitComponent={Hit} />
</InstantSearch>
);
} and these are my package versions:
If you like I can also try it out in a vanilla javascript environment |
The current type of
facets
in the searchOptions is:algoliasearch-client-javascript/packages/client-search/src/types/SearchOptions.ts
Line 104 in ba59b68
Nonetheless, while this is true when no facets are checked, once it is
facets
may contain a string.The text was updated successfully, but these errors were encountered: