Skip to content

Commit

Permalink
Update TypesenseEngine.php
Browse files Browse the repository at this point in the history
  • Loading branch information
alecritson committed Oct 21, 2024
1 parent b180009 commit bade995
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Engines/TypesenseEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ class TypesenseEngine extends AbstractEngine
protected function buildSearchOptions(array $options, string $query, $useFacetFilters = true): array
{
$filters = collect($options['filter_by']);
$facets = $this->getFacetConfig();

$facetQuery = collect();

foreach ($facets as $facetConfig) {
if (empty($facetConfig['facet_query'])) {
continue;
}
$facetQuery->push($facetConfig['facet_query']);
}

$facetQuery = $facetQuery->join(',');

foreach ($this->filters as $key => $value) {
$filters->push($key.':'.collect($value)->join(','));
Expand All @@ -43,6 +55,7 @@ protected function buildSearchOptions(array $options, string $query, $useFacetFi
}

$options['q'] = $query;
$options['facet_query'] = $facetQuery;
$facets = $this->getFacetConfig();
$facetBy = array_keys($facets);

Expand Down

0 comments on commit bade995

Please sign in to comment.