Hi i made search page with kirby’s search option.
but when I search word with space, they show even if only one of the two words is included…
It is very uncomfortable because when I search “jan blablabla” then they show "jan blablal"and “jannik”…
I found kirby’s search is using “or” option and change to "and"is not that easy…
then is there anyway to make select category before searching?
I really want to try algolia but I even don’t know where to start…
Check out this plugin: Better Search | Kirby CMS
There’s also an Algolia plugin in the getkirby.com repo: getkirby.com/site/plugins/search at main · getkirby/getkirby.com · GitHub
Thank you very much!
I upload that plugin and I don’t know where to put this…
$pages->bettersearch($string, $options)
my code is…
<?php
return function ($site) {
$query = get('q');
$results = page('home')->search($query, 'author|bookTitle|year|ISBN|category|librarian');
$results = $results->paginate(300);
return [
'query' => $query,
'results' => $results,
'pagination' => $results->pagination()
];
};
I put them on results… It is not wokring…
Instead of this line, use
$results = page('home')->index()->betterSearch($query, 'author|bookTitle|year|ISBN|category|librarian');
thank you but then thay said “Call to a member function paginate() on null”…
Ah, my mistake, the method name does not work with capital S
, use bettersearch
instead of betterSearch
.
Oh!! super!! thank you very much!!!