-
Notifications
You must be signed in to change notification settings - Fork 0
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
Advanced search form is overwhelming #1722
Conversation
@longhotsummer this is what we have now: |
Looking much better. I still think you're trying to fit the new world too much into how the old world worked. The advanced search UI is no longer field-driven, it's criteria driven, where each criteria is shown as a row, and can apply to one or more fields. Here's more detail: https://www.loom.com/share/be51337db24e4e06a906aae08e6631e4 And here's some pseudo-code to outline what I think that looks like: // the rows of the advanced search form
const advancedSearchCriteria = [{
text: "foo", // from the input box
fields: ["title", "content"], // from the fields checkboxes
condition: "AND", // from the AND/OR dropdown
phrase: false, // from the exact phrase checkbox
}, {
text: "bar boom",
fields: [], // default is ALL
condition: "NOT",
phrase: true,
}];
const advancedSearchDateCriteria = { ... }; // treat the dates separately to the rows above, they're different beasts
// the advanced search params to send to the server
const params = { ... (facets, etc.) }
function formatFieldQuery(criterion, params) {
let q = "";
if (criterion.condition == "AND") { ... }
else if (criterion.condition == "NOT" { ... }
// etc.
// add q to each of the search fields that its applicable to
// TODO: handle fields is empty therefore ALL fields
for (const fld of criterion.fields) {
params[`search_{fld}`] = (params[`search_{fld}`] || "") + " " + q
}
}
advancedSearchCriteria.forEach(c => addSearchParams(c, params)); |
Search tweaks
Closes #1714
Loom: https://www.loom.com/share/bbf99e9f4b5646c4a8b57ca1c1979ab7?sid=ed4871aa-cec1-4794-84e9-e02e298d6046