Skip to content

Commit

Permalink
fix phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
moitran committed Jun 1, 2024
1 parent 95f936b commit aec136a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/ElasticSearch/QueryBuilder/BookElasticQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ public function build(FormRequest $request): Builder
$providerId = $request->query('provider_id');

/** @var Builder $builder */
$builder = Book::search()
->property(TrackTotalHits::all());
$builder = Book::search();

if ($query) {
$bool = new BoolQuery();
$bool->should(new Matching('title', $query));
// title mathc query OR author match query
// title match query OR author match query
$bool->should(new Matching('author', $query));
$builder->filter($bool);
}
Expand All @@ -45,6 +44,8 @@ public function build(FormRequest $request): Builder
$builder->must(new Nested('provider', new Term('provider.id', $providerId)));
}

$builder->property(TrackTotalHits::all());

return $builder;
}
}

0 comments on commit aec136a

Please sign in to comment.