Closed nevali closed 9 years ago
The current query is:
UPDATE "index" SET "index_en_gb" = setweight(to_tsvector(coalesce("title" -> 'en-gb', "title" -> 'en', "title" -> '_')), 'A') || setweight(to_tsvector(coalesce("description" -> 'en-gb', "description" -> 'en', "description" -> '_')), 'B') WHERE "id" = 'cb90e10a13aa42ad82a0d047e56ab2bb';
If either of title or description is empty, then setweight() ends up returning an empty value (possibly NULL), which causes the whole expression to also be empty and so the item is not indexed.
title
description
setweight()
NULL
The query should instead read:
UPDATE "index" SET "index_en_gb" = setweight(to_tsvector(coalesce("title" -> 'en-gb', "title" -> 'en', "title" -> '_', '')), 'A') || setweight(to_tsvector(coalesce("description" -> 'en-gb', "description" -> 'en', "description" -> '_', '')), 'B') WHERE "id" = 'cb90e10a13aa42ad82a0d047e56ab2bb';
(i.e., include an empty string in the coalesce() call)
coalesce()
(Should have been against the bbcarchdev/spindle project)
The current query is:
If either of
title
ordescription
is empty, thensetweight()
ends up returning an empty value (possiblyNULL
), which causes the whole expression to also be empty and so the item is not indexed.The query should instead read:
(i.e., include an empty string in the
coalesce()
call)