I also stumbled across the ?searchfield=something
vs. ?query:something
issue. GRAV version is 1.3.2, simplesearch version is 1.13.0 and I am using own templates based on grav-skeleton-blog-site 1.3.1. If I use the search template from simplesearch, it generates the ?query:something
URL:
data-search-input="{{ base_url }}{{ config.plugins.simplesearch.route == '@self' ? '' : (config.plugins.simplesearch.route == '/' ? '' : config.plugins.simplesearch.route) }}/query"
But it still didnāt work with my browser (Chrome 38.0.2125.122). Yes itās an old browser, so YMMV, but I want downward compatibility of my website.
I had to change the Javascript included by the simplesearch plugin from:
var fields = document.querySelectorAll('input[name="searchfield"][data-search-input]');
fields.forEach(function(field) {
into:
[].forEach.call(
document.querySelectorAll('input[name="searchfield"]'), function(field) {
to make it work (forEach
loops over arrays, but not DOM objects in older browsers).
In order to be able to substitute the Javascript for simplesearchās built-in, I needed to modify simplesearch.php to not use its built-in JS, so I suppress it if built-in CSS is disabled (yes, I know that I shouldnāt modify standard files, but I found no other way to avoid editing the built-in Javascript and I already spent hours tracking down this bug or at least incompatibility with my Chrome version):
I changed simplesearch/simplesearch.php, line 294 from:
if ($this->config->get('plugins.simplesearch.built_in_css')) {
$this->grav['assets']->add('plugin://simplesearch/css/simplesearch.css');
}
$this->grav['assets']->addJs('plugin://simplesearch/js/simplesearch.js', [ 'group' => 'bottom' ]);
into:
if ($this->config->get('plugins.simplesearch.built_in_css')) {
$this->grav['assets']->add('plugin://simplesearch/css/simplesearch.css');
$this->grav['assets']->addJs('plugin://simplesearch/js/simplesearch.js', [ 'group' => 'bottom' ]);
}
and did include my own JS with the Asset Manager.
No it works with the results being filtered on the blog listing page and also with a separate result page using the ?query:something
syntax used in simplesearch templates.