Problem/Motivation

We are currently working on a site that requieres a custom URL for the search results page, in the format "buscar/keyword" (buscar = "search" in spanish). We had to use the Custom Search module, since Display Suite only allows to define paths that use the "search/anything/keyword" format (and the first component "search" is not editable).

The problem we found is that the search term was not being highlighted in the results page, even though we had the "Highlight search word" option activated and the HTML selector is properly defined. The reason was that the module assumes that the search word always is located at the third position of the path:

ds_search.module, lines 551-556

drupal_add_js(array(
      'ds_search' => array(
        'selector' => check_plain(variable_get('ds_search_highlight_selector', '.view-mode-search_result')),
        'search' => check_plain(arg(2)),
      ),
    ), 'setting');

Proposed resolution

There should be an option in the Display Suite Search settings page to indicate the position of the search term in the results page path. Furthermore, it also would be great to have the option to define custom paths that use a different format than "search/x/y".

Comments

swentel’s picture

Making that configurable would be cool indeed. I'm not sure it it's completely possible to have a configurable path, unless we have our own page callback of course.

swentel’s picture

Issue summary: View changes

correction: arg(2) stands for third component of path, not second

JuliaKoelsch’s picture

Issue summary: View changes

I just ran into this issue as well. Would it be a reasonable assumption that the search term be the last component of the path? That way it wouldn't need to be configurable, but still flexible to accommodate different URL structures.