allow minimum should match config
This commit is contained in:
parent
f21dc04a00
commit
d5eebf6c65
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Blomstra\Search\Api\Controllers;
|
||||
|
||||
use Blomstra\Search\Elasticsearch\BoolQuery;
|
||||
use Blomstra\Search\Elasticsearch\MatchPhraseQuery;
|
||||
use Blomstra\Search\Elasticsearch\MatchQuery;
|
||||
use Blomstra\Search\Elasticsearch\WildcardQuery;
|
||||
|
|
@ -21,7 +22,6 @@ use Illuminate\Support\Collection;
|
|||
use Illuminate\Support\Str;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Spatie\ElasticsearchQueryBuilder\Builder;
|
||||
use Spatie\ElasticsearchQueryBuilder\Queries\BoolQuery;
|
||||
use Spatie\ElasticsearchQueryBuilder\Queries\Query;
|
||||
use Spatie\ElasticsearchQueryBuilder\Queries\TermQuery;
|
||||
use Spatie\ElasticsearchQueryBuilder\Sorts\Sort;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace Blomstra\Search\Elasticsearch;
|
||||
|
||||
class BoolQuery extends \Spatie\ElasticsearchQueryBuilder\Queries\BoolQuery
|
||||
{
|
||||
protected int $minimumShouldMatch = 1;
|
||||
|
||||
public static function create(): static
|
||||
{
|
||||
return new self();
|
||||
}
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
$field = parent::toArray();
|
||||
|
||||
$field['bool']['minimum_should_match'] = $this->minimumShouldMatch;
|
||||
|
||||
return $field;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue