Skip to content

Commit 9ab25df

Browse files
committed
A few more tweaks
1 parent 11c8b7a commit 9ab25df

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/Typesense/Query.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ private function wheresToFilter(array $wheres): string
6262
break;
6363

6464
default:
65-
$filterBy .= $where['column'].':'.($where['operator'] != '=' ? $where['operator'] : '').$this->transformValueForTypeSense($schemaType, $where['value']);
65+
if ($where['operator'] == 'like') {
66+
$where['value'] = str_replace(['%"', '"%'], '', $where['value']);
67+
}
68+
69+
$filterBy .= $where['column'].':'.(! in_array($where['operator'], ['like']) ? $where['operator'] : '').$this->transformValueForTypeSense($schemaType, $where['value']);
6670
break;
6771
}
6872

@@ -73,11 +77,11 @@ private function wheresToFilter(array $wheres): string
7377
return $filterBy;
7478
}
7579

76-
private function transformArrayOfValuesForTypeSense(string $schemaType, array $values): array
80+
private function transformArrayOfValuesForTypeSense(string $schemaType, array $values): string
7781
{
7882
return json_encode(
79-
collect($where['values'])
80-
->map(fn ($value) => $this->transformValueForTypeSense($schemaType, $values))
83+
collect($values)
84+
->map(fn ($value) => ray($value) && $this->transformValueForTypeSense($schemaType, $value))
8185
->values()
8286
->all()
8387
);

0 commit comments

Comments
 (0)