I just discovered Custom Search, and it has solved many concerns I had for searches on a big site I'm creating.

But one issue I can't figure out is whether there is a setting to retain the user's search values on the search results page. To me, it seems logical to want to tailor a search after seeing the results, and having all the form fields be set would make that much easier for the user.

(I see these values in the URL arguments, but my users will not be sophisticated enough to modify those by hand.)

Thanks for any advice!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jdanthinne’s picture

Status: Active » Postponed (maintainer needs more info)
FileSize
14.32 KB

Hi,
what do you mean by "having all the form fields be set"? Which form? Which fields?
By default, the search field in the results page already contains the searched keyword.

Ie: the result page when I search "test"…

Test search

senortim’s picture

Hi, thanks. That's actually not the case for my search page. If I put "test" in my search field (either provided by the Search block, or on the Search results page itself), then click submit, the new results page's search box has Custom Search's default text (which in my case is "search").

So that's one issue. But the other is that I have lots of other search filters -- content types, taxonomies, and so on -- and it would be ideal if these *remembered* the previous submitted search.

Considering that this is pretty standard behavior, I feel like Custom Search probably does this, but if so, it isn't working at all for me.

(FWIW, on HTML pages I've built before Drupal, I checked $_POST values and then configured select options with those values, thus remembering the previous submission.)

jdanthinne’s picture

So what you want is to re-select the choices you've made for the initial search in the Search block (in the sidebar, or header, let's say), not the Search form in the results page (in the main content)?
In this case, it's a feature to implement, not a bug…

senortim’s picture

Category: support » feature

Thanks for your reply. I've changed the status to feature request. And considering that I probably need this for my project, I'll see whether I can contribute those changes.

garamani’s picture

Issue summary: View changes

@ jdanthinne: Please consider this Feature as a serious Request.
Having the Search inputs (keywords, content type selection) after submitting the search form, help users to refine the search results better.

jdanthinne’s picture

Every new request is considered serious, but I'm very busy at my daily job, and the free time I have for this module is used for the D8 transition.
New co-maintainers are welcome, patches as well.

garamani’s picture

FileSize
34.78 KB

Thanks for your quick and honest answer.

I understand that what you are doing for this module is personal passion more than anything. Actually this module fills a huge gap that Drupal doesn't offer out of the box. Having a custom search form and custom search results is the most important part of website.
Custom search module + Display suite module brings an acceptable customized search functionality.

So, if it's possible for you, please give this particular feature request a higher priority.

I need to accomplish something like this (using custom search selectors):

Custom search feature request

garamani’s picture

@ senortim: Have you found any solution, patch, ... ?

benjaminbradley’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
2.01 KB

I implemented this by adding a new configuration checkbox "Override search box text with current search query" just under the current Search Box Text configuration. If this is checked, and the current search query is not blank, it will be used as the default value of the search query textfield.

I wasn't sure of the best way to get the current search keyword value, so I'm just pulling it from arg(2) (as in /search/node/[keywords]). Let me know if there's a better way to do that.

Stolzenhain’s picture

If this is checked, and the current search query is not blank, it will be used as the default value of the search query textfield.

I'm not sure about the exact dangers, but injecting arguments straight into code usually has security implications; you should at least escape arg(2), I guess.

For the record: I was struggling with the same problem and realized it via Javascript injection, which is way more hacky, but also a bit more secure.