Closed mikeu closed 7 years ago
Resolves an issue in PostgresEngine::toVector, where a null value in any searchable model field would result in a null searchable column.
PostgresEngine::toVector
searchable
Because null values were only mapped to empty strings in the $select string, but not in the $fields array, select statements such as
$select
$fields
SELECT setweight(to_tsvector('x'), 'A') || setweight(to_tsvector(null), 'B') AS tsvector
could be generated. But that null value in the second element propagates all the way up so that the end result is equivalent to
null
SELECT null AS tsvector
To resolve this, I just moved the call to map on the searchable fields collection, so that its results are stored in the $fields array.
map
Great catch! Thank you so much. Tagged 0.2.1 with this patch and a test for it.
Thanks again.
Resolves an issue in
PostgresEngine::toVector
, where a null value in any searchable model field would result in a nullsearchable
column.Because null values were only mapped to empty strings in the
$select
string, but not in the$fields
array, select statements such ascould be generated. But that
null
value in the second element propagates all the way up so that the end result is equivalent toTo resolve this, I just moved the call to
map
on the searchable fields collection, so that its results are stored in the$fields
array.