fix partial matching and weighting

This commit is contained in:
Daniel Klabbers 2022-01-10 14:16:42 +01:00
parent 502f7a9f86
commit 803d1ecfc5
2 changed files with 3 additions and 3 deletions

View File

@ -56,6 +56,7 @@ class SearchController extends ListDiscussionsController
if (! empty($search)) {
$filterQuery
// @todo commented out to use only partial matching for now
// ->add($this->sentenceMatch($search))
// ->add($this->wordMatch($search, 'and'))
// ->add($this->wordMatch($search, 'or'))
@ -246,7 +247,7 @@ class SearchController extends ListDiscussionsController
protected function partialMatch(string $q)
{
$query = (new MatchQuery('content_partial', $q));
$query = (new MatchQuery('content', $q));
return BoolQuery::create()
// Discussion titles

View File

@ -43,8 +43,7 @@ class BuildCommand extends Command
$properties = [
'properties' => [
'content' => ['type' => 'text', 'analyzer' => 'flarum_analyzer'],
'content_partial' => ['type' => 'text', 'analyzer' => 'flarum_analyzer_partial', 'search_analyzer' => 'flarum_analyzer'],
'content' => ['type' => 'text', 'analyzer' => 'flarum_analyzer_partial', 'search_analyzer' => 'flarum_analyzer'],
'created_at' => ['type' => 'date'],
'updated_at' => ['type' => 'date'],
'is_private' => ['type' => 'boolean'],