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:
parent
5a9e874d52
commit
a749b331f1
1 changed files with 7 additions and 2 deletions
|
@ -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") {
|
||||||
|
|
Loading…
Reference in a new issue