Skip to content

Commit

Permalink
fix: id search works now with equal operator
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviareichl committed Oct 14, 2024
1 parent 46a6440 commit 73a48aa
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions components/data-view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ const searchFiltersSchema = v.object({
),
});
const idCategories = ["entityID", "typeID", "valueTypeID", "typeIDWithSubs"];
const searchFilters = computed(() => {
return v.parse(searchFiltersSchema, route.query);
});
Expand Down Expand Up @@ -82,18 +84,21 @@ const { data, isPending, isPlaceholderData } = useGetSearchResults(
computed(() => {
const { search, category, ...params } = searchFilters.value;
const operator = idCategories.includes(category) ? "equal" : "like";
const searchQuery =
search && search.length > 0
? [{ [category]: [{ operator, values: [search], logicalOperator: "and" }] }]
: [];
return {
...params,
search:
search.length > 0
? [{ [category]: [{ operator: "like", values: [search], logicalOperator: "and" }] }]
: [],
search: searchQuery,
show: ["description", "when"],
view_classes: ["actor", "event", "place", "reference", "source"],
};
}),
);
const isLoading = computed(() => {
return isPending.value || isPlaceholderData.value;
});
Expand Down

0 comments on commit 73a48aa

Please sign in to comment.