getgrav / grav-plugin-simplesearch

Grav SimpleSearch Plugin
https://getgrav.org
MIT License
44 stars 55 forks source link

Search fail if key `filters:` is not present #70

Open magnetik opened 8 years ago

magnetik commented 8 years ago

Hi,

When using the admin plugin, when I remove the only tag in the Category filter, the line filters: is deleted from simplesearch.yaml.

When this line is not present, the search fail even when there are result.

After adding the line filters: manually, the search works again.

And when editing another field in the admin plugin, the line is removed again.

flaviocopes commented 8 years ago

I don't see any problem. Are you using the latest releases of Grav + Admin + SimpleSearch?

gitname commented 7 years ago

I see this also.

Here are my observations from 3 experiments I did while using Grav v1.1.5, Admin v1.2.2, and SimpleSearch v1.9.2. I labeled the experiments below with the letters A, B, and C for future reference.

I ran experiment C because I didn't know whether the only reason the search yielded 0 results in experiment B was that I had defined a filter_combinator, but not a filter.

A. With the filters key present

user\config\plugins\simplesearch.yaml:

enabled: true
built_in_css: true
display_button: true
min_query_length: 3
route: /search
template: simplesearch_results
filters:
filter_combinator: and
order:
    by: date
    dir: desc

The search yields 1 result.

Here's a screenshot of search results page in my web browser:

image


B. With the filters key absent

user\config\plugins\simplesearch.yaml:

enabled: true
built_in_css: true
display_button: true
min_query_length: 3
route: /search
template: simplesearch_results
filter_combinator: and
order:
    by: date
    dir: desc

The search yields 0 result.

Here's a screenshot of search results page in my web browser:

image


C. With the filters and filter_combinator key absent

user\config\plugins\simplesearch.yaml:

enabled: true
built_in_css: true
display_button: true
min_query_length: 3
route: /search
template: simplesearch_results
order:
    by: date
    dir: desc

The search yields 0 results.

Here's a screenshot of search results page in my web browser:

image


For reference, I'm using PHP 5.5.9.

xadammr commented 7 years ago

I can reproduce in SimpleSearch 1.9.3 / Grav 1.1.6 / Admin 1.2.3 / PHP 5.6.23.

LukeAskew commented 7 years ago

Fails for me as well.

PHP v7.0.10 Grav v1.1.8 Admin v1.2.4

kalebheitzman commented 7 years ago

Interesting tidbit: The plugin keeps changing the filter back to blog if you set it to empty in the YAML file.

core77 commented 7 years ago

The same happens here. No results when the filter key is not present.

When I change SimpleSearch options from admin, for example I set 'use builtin css' to false, the filter key has been deletet from the /user/config/plugins/simplesearch.yaml

PHP 7.1.0 Grav 1.1.12 Admin 1.2.7 SimpleSearch 1.9.3