Closed oshyne closed 7 years ago
The latest develop
branch of this plugin has 2 commits that fix this issue, and you can add the @none
placeholder in the category filter, and it will search everywhere. Give it a try and let me know if it works for you.
The problem with your config is, since filters
is missing in your user config, the default plugin config is applied.
Thanks so much for your response.
I added @none to category filter in admin but still doesn't search site wide.
I also tried adding @none to category filter in /user/plugins/simplesearch/simplesearch.yaml but still not working.
I entered multiple categories in the category filter in admin but still not working.
I am using the latest version of the plugin.
I appreciate your kind assistance. Thanks.
Latest version you mean the one available through Grav's plugins, or the latest develop
branch here? https://github.com/getgrav/grav-plugin-simplesearch/commits/develop
Available through grav plugin manager.
Thanks
Ok, I just implemented this feature a couple days ago and it's not yet in the latest release. Download https://github.com/getgrav/grav-plugin-simplesearch/archive/develop.zip and unzip in user/plugins/simplesearch
. That should make it work.
I unzipped into user/plugin/simplesearch then i went ahead to add @none
to category filter option in admin and got the following error message when i tried to search for a keyword.
C:\wamp\www\unndlc-grav2\user\plugins\simplesearch\simplesearch.php
private function notFound($query, $page, $taxonomies)
{
$searchable_types = ['title', 'content', 'taxonomy'];
$results = true;
foreach ($searchable_types as $type) {
if ($type === 'title') {
$result = $this->matchText(strip_tags($page->title()), $query) === false;
} elseif ($type === 'taxonomy') {
if ($taxonomies === false) {
continue;
}
$page_taxonomies = $page->taxonomy();
$taxonomy_match = false;
foreach ((array) $page_taxonomies as $taxonomy => $values) {
// if taxonomies filter set, make sure taxonomy filter is valid
if (is_array($taxonomies) && !empty($taxonomies) && !in_array($taxonomy, $taxonomies)) {
continue;
}
$taxonomy_values = implode('|',$values);
if ($this->matchText($taxonomy_values, $query) !== false) {
$taxonomy_match = true;
break;
}
}
$result = !$taxonomy_match;
} else {
$result = $this->matchText(strip_tags($page->content()), $query) === false;
}
$results = $results && $result;
if ($results === false ) {
break;
}
}
return $results;
}
}
Arguments
"implode(): Invalid arguments passed"
This is the settings in user/config/plugins/simplesearch.yaml
enabled: true
built_in_css: true
display_button: false
min_query_length: 3
route: /search
template: simplesearch_results
filters:
category:
- @none
filter_combinator: and
ignore_accented_characters: false
order:
by: date
dir: desc
Thanks so much.
Ouch! Can you paste your /user/plugins/simplesearch/simplesearch.yaml content?
enabled: true
built_in_css: true
display_button: false
min_query_length: 3
route: /search
template: simplesearch_results
filters:
category: News
filter_combinator: and
ignore_accented_characters: false
order:
by: date
dir: desc
thanks, and /user/config/plugins/simplesearch.yaml ?
/user/config/plugins/simplesearch.yaml
enabled: true
built_in_css: true
display_button: false
min_query_length: 3
route: /search
template: simplesearch_results
filter_combinator: and
ignore_accented_characters: false
order:
by: date
dir: desc
Thanks so much
The latest release should fix it. In the plugin configuration through Admin, set @none in the category filter.
My settings in: /user/plugins/simplesearch/simplesearch.yaml
My settings in: user/config/plugins/simplesearch.yaml
If i search for an article or a keyword inside the news category it shows in the search results; but does not show other articles not assigned to the news category but contain same keyword.
I also observed that settings in user/config/plugins/simplesearch.yaml don't seem to be honoured. I tried assigning categories to the different pages and entering their names in the category filter box of the admin but it doesn't work.
Please, how can i add multiple categories in /user/plugins/simplesearch/simplesearch.yaml so that the pages in those categories can display in the search result.
Tried this but isn't working: category: [News, events]
I have a corporate website with different sections such as news, events, FAQ, company profile, etc., so i wish that a user can search for any page contained on the site with the general search box provided.
Thanks for your assistance!!!