1

I have inherited a Drupal site with a node that uses /search-results as path alias.

The page works fine if I use https://example.com/search-results?keys=test or https://example.com/search-results?keys, but it returns a 404 error if I use https://example.com/search-results.

Any thoughts on where to begin?

1 Answer 1

0

How do you process the parameter? Is there a module to look at it? or you do it in your .theme hooks?

In any case you wanna try to set a default respose for the function you are using to process that key parameter.

5
  • That is a very good question. I've checked the .theme and didn't see anything. There is a search api module installed which I am not familiar with. The search form (on all pages) has an action for '/search-result', on that page, it says it is for an override of main view template and it uses 'exposed.keys' with comment: "exposed: Exposed widget form/info to display." From there, i cannot see why this page would end up with a 404 error if that query parameter is not included.
    – user110161
    Commented Apr 19, 2023 at 21:53
  • Did you know if ther's a view named search-results or something like that? Commented Apr 19, 2023 at 22:04
  • this is what i can see: there is a template in the theme named: page--search-result.html.twig it contains an embed view (set in the .theme file) named views-view--search-content.html.twig. if that embedded view is commented out in the page--search-result.html.twig the page will load (obviously without any results) as soon as it is added back in, the 404 occurs even if nothing is on that embedded page.
    – user110161
    Commented Apr 19, 2023 at 22:19
  • it looks like it is using a built in filter Views->Search Content -> FILTER CRITERIA Configure filter criterion: Search: Fulltext search has 'keys' as the Filter identifier
    – user110161
    Commented Apr 20, 2023 at 12:58
  • In this configuration, did you see any CONTEXTUAL FILTERS under the ADVANCED tab? Commented Apr 20, 2023 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.