Problem/Motivation
When using Advanced Search on a Node search page, you have to enter keywords even if there are other valid search conditions chosen. You shouldn't have to.
See also
#487764: Allow wildcards like * in search
which had a similar original request but has been changed to be an issue about supporting wildcards in the keyword field (because wanting wildcards in searches is a common feature request).
Proposed resolution
Make it so that you do not have to enter keywords in order to search, if there are other conditions present.
Remaining tasks
Patch with test.
User interface changes
Users will be able to use Advanced Search for things like taxonomy and node type, without entering keywords.
API changes
The search query will support searches without keywords.
Original report by pwolanin
Late in the 7.x cycle we added the notion of non-keyword search conditions. Seems like we didn't quite finish that patch.
Search module for either the search block or main search form will print the error 'Please enter some keywords.' even if the module implementing the search hooks has satisified some conditions and will run a search.
Comment | File | Size | Author |
---|---|---|---|
#11 | respect_conditions-1126688-11.patch | 4.36 KB | Albert Volkman |
Comments
Comment #1
pwolanin CreditAttribution: pwolanin commentedone option for the search page is to add another param to the search_form function - otherwise we always have to call the conditions callback 2x
Comment #2
pwolanin CreditAttribution: pwolanin commentedhave to put the conditions flag into the form as a hidden value due to the fact that we skip the conditions callback while processing the POST...
Comment #3
jhodgdonA few mostly minor issues with the patch:
a) Typo at the end of this line:
b)
I think it should be a #type = 'value' not 'hidden' here? 'hidden' adds it to the form that is rendered, where 'value' makes it all behind the scenes and is what is normally used to pass information around in forms, right?
c) Why remove all those blank lines from the code? I think they were reasonable to keep...
d)
Needs a space before the =
e) Do we need a test for this?
Comment #4
Albert Volkman CreditAttribution: Albert Volkman commentedNot sure about tests, but here is a re-roll for 8.x.
Comment #6
pwolanin CreditAttribution: pwolanin commentedComment #7
pwolanin CreditAttribution: pwolanin commentedComment #8
jhodgdonYou actually don't need to put the "related" field on both issues. If you put it on one, it shows up on the other. :)
Comment #9
jhodgdonMade a better issue summary.
Comment #10
Albert Volkman CreditAttribution: Albert Volkman commentedThis appears to be resolved in 8.x after the form conversion. Moving back to 7.x.
Comment #11
Albert Volkman CreditAttribution: Albert Volkman commentedRe-roll for 7.x (still needs work).
Comment #12
jhodgdonUm. I kind of disagree here. The only reason it is "working" in D8 is that the "please enter some keywords" text is not being displayed at all, as far as I can tell.
I am only seeing the "please enter some keywords" when searching from the search block, but it isn't happening from /search/node.
Comment #13
jhodgdonI filed a separate issue for the missing "please enter some keywords" message in D8 and we should wait to test this again until that is fixed.
#2170411: Please enter some keywords message has vanished
Comment #14
jhodgdonWe need to redo how errors and warnings are handled in searching on #1366020: Overhaul SearchQuery; make search redirects use GET query params for keywords, which will hopefully take care of this problem for 8.x anyway, so I'm postponing this until that one is done.
Comment #15
Albert Volkman CreditAttribution: Albert Volkman commentedYep, you're totally right. Sorry for the oversight.
Comment #16
jhodgdonAfter working on that other issue for a while... I've decided this one can be un-postponed.
But we need to decide what to do about it.
The idea that is currently in the issue summary is to make it possible to search nodes with no keywords entered at all. That is not going to be resolved by the patch in #1366020: Overhaul SearchQuery; make search redirects use GET query params for keywords. That issue will make sure that you can do a search by entering either a phrase or some "or" words in the Advanced search box, but you will still need to enter at least one "positive" keyword for the search query to work, as it is currently written.
So if we want to allow someone to search by, for instance, just taxonomy and node type, we would need to revise how the search query is built (it can't be a query based on the {search_index} table if there are no keywords to match).
As such... it's really a feature request.
Comment #17
jhodgdonComment #18
jhodgdonSince 8.0.x-beta1 has been released, our policy at this point is No feature requests until 8.1.x. See #2350615: [policy, no patch] What changes can be accepted during the Drupal 8 beta phase?. Sorry, it's just too late for 8.0.x at this point, so even if we had a viable patch, the core committers would not commit it.