1
0
Fork 0
forked from OpenNeo/impress

Fix multi-word search in outfit editor

Oops, prior to this commit, searching for "white peach" would return
nothing, whereas now it correctly returns the "Dyeworks White: Just
Peachy Filter", like if you search in the Infinite Closet!

This solution is a bit hacky, wrote some more in the comments about how
to maybe do this better!
This commit is contained in:
Emi Matchu 2024-05-06 14:58:03 -07:00
parent 5a9e874d52
commit a749b331f1

View file

@ -43,8 +43,13 @@ export function useSearchResults(
function buildSearchFilters(query, { speciesId, colorId, altStyleId }) { function buildSearchFilters(query, { speciesId, colorId, altStyleId }) {
const filters = []; const filters = [];
if (query.value) { // TODO: We're missing quote support, like `background "Dyeworks White"`.
filters.push({ key: "name", value: query.value }); // It might be good to, rather than parse this out here and send it as
// filters, include a text-based part of the query as well, and have
// the server merge them? That'd support text-based `is:nc` etc too.
const words = query.value.split(/\s+/);
for (const word of words) {
filters.push({ key: "name", value: word });
} }
if (query.filterToItemKind === "NC") { if (query.filterToItemKind === "NC") {