Skip to content

Commit

Permalink
fix: only show erstpublikationen in faceted search (closes #4)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinstadler committed Oct 7, 2024
1 parent 03d55bb commit 1c9e6d6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
16 changes: 6 additions & 10 deletions components/instantsearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,12 @@ export function InstantSearch(props: InstantSearchProps): ReactNode {
searchClient={searchClient}
>
<Configure
filters={
filters
? Object.keys(filters)
.map((k) => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return `${k}:= ${filters[k]!}`;
})
.join(" and ")
: undefined
}
filters={[
"erstpublikation:true",
...Object.entries(filters ?? {}).map(([k, v]) => {
return `(${k}:=\`${v}\`)`;
}),
].join(" && ")} // typesense convention, not instantsearch!
/>
<div>{children}</div>
<div>
Expand Down
11 changes: 11 additions & 0 deletions scripts/data/typesense-schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
{
"name": "thomas-bernhard",
"fields": [
{
"name": "erstpublikation",
"type": "bool",
"facet": false,
"optional": false,
"index": true,
"sort": false,
"infix": false,
"locale": "",
"stem": false
},
{
"name": "year",
"type": "int32",
Expand Down

0 comments on commit 1c9e6d6

Please sign in to comment.