From d7c6ad8e1400be7619b2f8b848b324bad9e033ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Mon, 20 Apr 2026 14:43:22 +0200 Subject: [PATCH] Remove unnecessary whereNotNull guard from facets subquery MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The whereNotNull('final_entities.final_entity') was copied from other code paths that select the final_entity column, but the facets subquery only needs entity_id. Removing it preserves exact v1.49 semantics (search rows only exist for stitched entities anyway, due to the FK cascade from search -> final_entities) and avoids an inconsistency where the no-filter path did not exclude unstitched entities while the with-filter path did. Signed-off-by: Fredrik Adelöw Made-with: Cursor --- .../catalog-backend/src/service/DefaultEntitiesCatalog.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.ts b/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.ts index 830120e486..29d9d915df 100644 --- a/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.ts +++ b/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.ts @@ -695,9 +695,9 @@ export class DefaultEntitiesCatalog implements EntitiesCatalog { // against one-row-per-entity rather than the much larger search // table. This keeps the facets aggregation fast even with many // filter clauses or permission conditions. - const entityIdSubquery = this.database('final_entities') - .select('final_entities.entity_id') - .whereNotNull('final_entities.final_entity'); + const entityIdSubquery = this.database('final_entities').select( + 'final_entities.entity_id', + ); applyEntityFilterToQuery({ filter: request.filter,