From 803d1ecfc554fff1fd515c57c0f3de88f48524f5 Mon Sep 17 00:00:00 2001 From: Daniel Klabbers Date: Mon, 10 Jan 2022 14:16:42 +0100 Subject: [PATCH] fix partial matching and weighting --- src/Api/Controllers/SearchController.php | 3 ++- src/Commands/BuildCommand.php | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Api/Controllers/SearchController.php b/src/Api/Controllers/SearchController.php index 7166b7d..0cae6a9 100644 --- a/src/Api/Controllers/SearchController.php +++ b/src/Api/Controllers/SearchController.php @@ -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 diff --git a/src/Commands/BuildCommand.php b/src/Commands/BuildCommand.php index 74271c1..3494c94 100644 --- a/src/Commands/BuildCommand.php +++ b/src/Commands/BuildCommand.php @@ -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'],