Skip to content
This repository was archived by the owner on Dec 12, 2021. It is now read-only.

Commit 7fdd1a0

Browse files
- Fix building location order & other order fields.
1 parent 17064cb commit 7fdd1a0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Engines/TypesenseSearchEngine.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,12 @@ private function buildSearchParams(Builder $builder, int $page, int $perPage): a
160160
$params['sort_by'] = $this->parseOrderByLocation(...$this->locationOrderBy);
161161
}
162162

163-
if ($builder->orders) {
163+
if (!empty($builder->orders)) {
164+
if (!empty($params['sort_by'])) {
165+
$params['sort_by'] .= ',';
166+
} else {
167+
$params['sort_by'] = '';
168+
}
164169
$params['sort_by'] .= $this->parseOrderBy($builder->orders);
165170
}
166171

@@ -444,7 +449,7 @@ public function limitHits(int $limitHits): static
444449
public function orderByLocation(string $column, float $lat, float $lng, string $radius, bool $excludeRadius): static
445450
{
446451
$this->locationOrderBy = [
447-
'column' => $excludeRadius,
452+
'column' => $column,
448453
'lat' => $lat,
449454
'lng' => $lng,
450455
'radius' => $radius,

0 commit comments

Comments
 (0)