@byline/db-postgres 3.20.2 → 3.20.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@
9
9
  // constructs query/command classes before initBylineCore() wires up the Pino
10
10
  // logger. A future refactor could inject the logger at construction time by
11
11
  // either deferring adapter construction or accepting a lazy logger parameter.
12
- import { ERR_DATABASE, ERR_NOT_FOUND, getLogger, orderByContentLocale } from '@byline/core';
12
+ import { ERR_DATABASE, ERR_NOT_FOUND, getLogger, orderByContentLocale, resolveIdentityField, } from '@byline/core';
13
13
  import { and, desc, eq, inArray, isNotNull, isNull, sql } from 'drizzle-orm';
14
14
  import { collections, currentDocumentsView, currentPublishedDocumentsView, documentAvailableLocales, documentPaths, documentRelationships, documents, documentVersionLocales, documentVersions, metaStore, } from '../../database/schema/index.js';
15
15
  import { extractFlattenedFieldValue, restoreFieldSetData } from './storage-restore.js';
@@ -1230,16 +1230,17 @@ export class DocumentQueries {
1230
1230
  if (pathFilter) {
1231
1231
  conditions.push(this.buildFilterCondition(this.pathProjection(sql `d.document_id`, locale, sql `d.source_locale`), pathFilter.operator, pathFilter.value));
1232
1232
  }
1233
- // Text search across configured search fields via EXISTS on store_text.
1233
+ // Admin list-view quick search via EXISTS on store_text.
1234
1234
  if (query) {
1235
1235
  const definition = await this.getDefinitionForCollection(collection_id);
1236
- // The admin list-view box matches store_text rows by field name. Derive
1237
- // the names from the role-based `search.body` declaration (a field path
1238
- // or `{ field, boost }`); fall back to the identity-ish `title`.
1239
- const bodyDecls = definition.search?.body ?? [];
1240
- const searchFields = bodyDecls.length > 0
1241
- ? bodyDecls.map((decl) => (typeof decl === 'string' ? decl : decl.field))
1242
- : ['title'];
1236
+ // The list-view box matches store_text rows by field name, from the
1237
+ // schema-level `listSearch` declaration; fall back to the collection's
1238
+ // identity field (`useAsTitle`, else its first text field).
1239
+ // Deliberately independent of the `search` (provider / site-search
1240
+ // indexing) config see `CollectionDefinition.listSearch`.
1241
+ const searchFields = definition.listSearch != null && definition.listSearch.length > 0
1242
+ ? definition.listSearch
1243
+ : [resolveIdentityField(definition) ?? 'title'];
1243
1244
  const searchConditions = searchFields.map((fieldName) => sql `(field_name = ${fieldName} AND value ILIKE ${`%${query}%`})`);
1244
1245
  conditions.push(sql `EXISTS (
1245
1246
  SELECT 1 FROM byline_store_text
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@byline/db-postgres",
3
3
  "private": false,
4
4
  "license": "MPL-2.0",
5
- "version": "3.20.2",
5
+ "version": "3.20.4",
6
6
  "engines": {
7
7
  "node": ">=20.9.0"
8
8
  },
@@ -56,9 +56,9 @@
56
56
  "npm-run-all": "^4.1.5",
57
57
  "pg": "^8.22.0",
58
58
  "uuid": "^14.0.1",
59
- "@byline/admin": "3.20.2",
60
- "@byline/auth": "3.20.2",
61
- "@byline/core": "3.20.2"
59
+ "@byline/admin": "3.20.4",
60
+ "@byline/core": "3.20.4",
61
+ "@byline/auth": "3.20.4"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@biomejs/biome": "2.5.2",