Problem/Motivation
When searching issues on drupal.org, you are first presented with a "regular" search form (/project/issues) with filters:
- Search for (keyword)
- Project
- Status
- Priority
- Category
If you first do a search there, perhaps typing in the keywords "advanced search" and then click the "Search" button, you will get search results.
If then you decide you really would prefer to use the "Advanced search" form, you click the "Advanced search" link and the filters you had entered before disappear which is bad UX. The user has to add the filters again. Obviously, they probably want some different filters (which is why they chose "Advanced search" in the first place), but it's likely that at minimum the keywords and project should be preserved.
Steps to reproduce
- Go to drupal.org/project/issues
- Type in "advanced search" (or any text you would like) into the "Search for" text box
- Click the "Search" button
- Click the "Advanced search" link
- Note that the "Search for" text box is empty
Proposed resolution
Figure out the mapping between the regular and the advanced search form filter values and potentially tack on the query params to the "Advanced search" link.
For example, regular search params:
?text=advanced+search&projects=Drupal.org+customizations&status=Open&priorities=200&categories=1
Would map to advanced search params:
?text=advanced+search&projects=Drupal.org+customizations&assigned=&submitted=&project_issue_followers=&status[]=Open&priorities[]=200&categories[]=1&issue_tags_op=%3D&issue_tags=
Note that there might be some gotchas for project-specific forms so make sure to test some specific projects.
Remaining tasks
Get consensus on this improvementCreate patch- Review patch
- Commit patch :)
- Deploy
User interface changes
Advanced search filters would be pre-filled with values if the regular search was already performed and they went to the advanced search from the regular search.
API changes
Adds a new alter hook, hook_project_issue_advanced_search_parameters_alter()
Adds a new internal helper method: _project_issue_convert_search_query()
Comment | File | Size | Author |
---|---|---|---|
#19 | 3161134-17.patch | 4.4 KB | dww |
#10 | 3161134-10.patch | 5.13 KB | dww |
Comments
Comment #2
Kristen PolComment #3
Kristen PolComment #4
dww@Kristen Pol pinged me on Slack about this. Pasting some notes from our convo here for posterity:
Here's the root of your problem in 3 URLs:
https://www.drupal.org/project/issues/project_issue?priorities=400
https://www.drupal.org/project/issues/search/project_issue?priorities=400
https://www.drupal.org/project/issues/search/project_issue?priorities[]=400
- - -
It's also a rat's nest since sites (like d.o) can/do have different filters than the default views that project_issue provides. :(
So it's hard to do this generally right in project_issue.
But that's what's providing the adv search links. :(
- - -
project_issue_query_result_links() is where the adv search link is created.
Which is invoked by project_issue/views/handlers/project_issue_handler_area_issue_search_links.inc which is what places them in the view.
- - -
Reading the summary, I'd also point out there are two cases... the site-wide search vs. advance search mentioned in the summary, but also the per-project versions of these, e.g. the links I'm pasting here. This 2nd case already correctly preserves the project, so that's a little more simple. But the per-project views have other fields not found sitewide (version, component, etc).
Comment #5
Kristen PolThanks @dww!
Comment #6
drummWe should only need to forward the values for the filters on the basic issue search page. On Drupal.org, those are
I’m hoping we haven’t managed to get any of those diverged from project_issue module. If they haven’t, or we correct that, then this could go in project_issue itself. That would be much better from a maintenance perspective.
I’ve always wanted to try merging the advanced issue search pages into one. I haven’t seen a good solution for keeping the exposed filters less-cluttered, while keeping them easy to use.
Comment #7
dwwOkay, sounds good. I'm down to try to do this in project_issue, and only handle the filters provided with the default views. That'll certainly be easier, since that's what's generating the links in the first place.
Comment #8
dwwNot the prettiest code ever, but it gets the job done. ;)
Site-wide
Regular search:
https://project-drupal.dev.devdrupal.org/project/issues?text=value&proje...
Contains advanced link:
https://project-drupal.dev.devdrupal.org/project/issues/search?text=valu...
Project-specific
Regular search:
https://project-drupal.dev.devdrupal.org/project/issues/drupal?text=filt...
Contains advanced link:
https://project-drupal.dev.devdrupal.org/project/issues/search/drupal?te...
Comment #9
dwwSorry, juggling too many directories. ;) Here's the actual working patch I meant to attach...
Comment #10
dwwDocumenting the new alter hook, too...
Comment #11
dwwHah, whoops. I just noticed the last link in #8 is getting the issue count when it shouldn't. ;)
Opened #3162080: Make sure issue-count.js is only kicking in on links to the current site for that.
Comment #12
dwwOpen questions (referenced in the @todo comment):
Should we actually keep inserting the 'Advanced search' link when we're already on the advanced search page itself?
Seems pretty weird. I'm not totally clear why we still do this. I know it was like this ages ago when I first started maintaining this whole mess, and we kept it working like that to "preserve BC" (sort of) ever since. Once upon a time, before the era of the 'Reset' button, I would at times use it as a reset link to clear a complicated search. But 'Reset' is a way better solution for that. Is there any reason to keep it?
Should we kill it here or propose that in a separate issue? Who exactly would need to sign off on such a change?
Thanks,
-Derek
Comment #13
Kristen PolThanks @dww! I haven't looked at the code yet but have tested pretty thoroughly.
I noticed a couple things so I'm adding some screenshots:
1) The basic search defaults to
- Open issues -
yet when you do the advanced search,- Open issues -
isn't selected. This behavior is the same if I switch away from- Open issues -
to something else and then back to- Open issues -
.2) If I switch to
- Any -
in the basic search and then go to the advanced search, I get an error:An illegal choice has been detected. Please contact the site administrator.
As for your questions from #12:
I think this is confusing and should be removed.
I would include it in this issue. I don't know about the sign off but the user is not losing any functionality. It's just less confusing, IMO.
Comment #14
Kristen PolWhoops!
UPDATE: I quickly reviewed the code and didn't see anything glaring other than it'll obviously need to change if the advanced search link is removed from the advanced search page.
Comment #15
drummI don’t remember why we would have that at all. I can see it being used as a reset, I suspect that’s not common. I think go ahead and commit removing it, either here or a separate issue, and we’ll see if anyone misses it.
Comment #16
dwwThanks for the reviews and testing!
Spun off #3162278: Remove 'Advanced search' link when you're already on advanced search for that part. Definitely cleans this up considerably to do that, first.
Re: #13.1: That's all by design. Regular search defaults to only 'Open' issues, whereas advanced defaults to showing everything. We don't want to change that here, so we shouldn't change that default behavior if you haven't touched the status.
Re: #13.2: Good catch. I'll fix that next.
To start, here's a re-roll/re-build after #3162278-2.
Comment #17
dwwFixes #13.2: We always want to ignore any regular search filter set to 'All' when we land on advanced search.
Also removes a bogus hunk that leaked into #16.
Now deployed on https://project-drupal.dev.devdrupal.org if anyone wants to re-test.
E.g. #13.2:
https://project-drupal.dev.devdrupal.org/project/issues/drupal?text=filt...
sends you to:
https://project-drupal.dev.devdrupal.org/project/issues/search/drupal?te...
(which no longer has an 'Advanced search' link, thanks to #3162278: Remove 'Advanced search' link when you're already on advanced search ;)
Comment #18
Kristen PolWoot! I think it's still a bit odd that if I actively choose
- Open issues -
by choosing something else and searching and then choosing it again, that it doesn't default to- Open issues -
on the advanced form but I can live without that based on the reasoning above. :)I tested all the filters again and they are otherwise working great.
I was going to mark RTBC, but not sure why this got commented out so marking back to needs work in case that needs fixing.
Comment #19
dwwUgh! Forgot to attach the patch to #17. ;) That hunk you commented on is what I meant by: "Also removes a bogus hunk that leaked into #16." But you wouldn't know that, since I completely failed to upload the fix. ;)
Comment #20
Kristen PolInterdiff looks good, thanks!
Comment #22
dwwGreat, thanks again for reviews and testing.
Pushed to 7.x-2.x.
Tagging for Neil to deploy.
Yay,
-Derek
Comment #23
drummThis is now deployed.
Comment #24
Kristen PolWoot! Thanks @dww and @drumm!
Comment #25
dwwSweet, yay. ;)
Thanks, @Kristen Pol for suggesting this!