@backstage/plugin-catalog-backend 1.8.0 → 1.8.1-next.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @backstage/plugin-catalog-backend
2
2
 
3
+ ## 1.8.1-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - c9a0fdcd2c8: Fix deprecated types.
8
+ - 899ebfd8e02: Add full text search support to the `by-query` endpoint.
9
+ - Updated dependencies
10
+ - @backstage/plugin-scaffolder-common@1.2.7-next.0
11
+ - @backstage/backend-common@0.18.4-next.0
12
+ - @backstage/config@1.0.7
13
+ - @backstage/integration@1.4.3
14
+ - @backstage/backend-plugin-api@0.5.1-next.0
15
+ - @backstage/catalog-client@1.4.0
16
+ - @backstage/catalog-model@1.2.1
17
+ - @backstage/errors@1.1.5
18
+ - @backstage/types@1.0.2
19
+ - @backstage/plugin-catalog-common@1.0.12
20
+ - @backstage/plugin-catalog-node@1.3.5-next.0
21
+ - @backstage/plugin-permission-common@0.7.4
22
+ - @backstage/plugin-permission-node@0.7.7-next.0
23
+ - @backstage/plugin-search-common@1.2.2
24
+
3
25
  ## 1.8.0
4
26
 
5
27
  ### Minor Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-backend",
3
- "version": "1.8.0",
3
+ "version": "1.8.1-next.0",
4
4
  "main": "../dist/alpha.cjs.js",
5
5
  "types": "../dist/alpha.d.ts"
6
6
  }
package/dist/alpha.cjs.js CHANGED
@@ -2245,7 +2245,7 @@ class DefaultEntitiesCatalog {
2245
2245
  return { items };
2246
2246
  }
2247
2247
  async queryEntities(request) {
2248
- var _a, _b, _c;
2248
+ var _a, _b, _c, _d, _e;
2249
2249
  const db = this.database;
2250
2250
  const limit = (_a = request.limit) != null ? _a : DEFAULT_LIMIT;
2251
2251
  const cursor = {
@@ -2267,11 +2267,22 @@ class DefaultEntitiesCatalog {
2267
2267
  parseFilter(cursor.filter, dbQuery, db, false, "search.entity_id");
2268
2268
  }
2269
2269
  const normalizedFullTextFilterTerm = (_c = (_b = cursor.fullTextFilter) == null ? void 0 : _b.term) == null ? void 0 : _c.trim();
2270
+ const textFilterFields = (_e = (_d = cursor.fullTextFilter) == null ? void 0 : _d.fields) != null ? _e : [sortField.field];
2270
2271
  if (normalizedFullTextFilterTerm) {
2271
- dbQuery.andWhereRaw(
2272
- "value like ?",
2273
- `%${normalizedFullTextFilterTerm.toLocaleLowerCase("en-US")}%`
2274
- );
2272
+ if (textFilterFields.length === 1 && textFilterFields[0] === sortField.field) {
2273
+ dbQuery.andWhereRaw(
2274
+ "value like ?",
2275
+ `%${normalizedFullTextFilterTerm.toLocaleLowerCase("en-US")}%`
2276
+ );
2277
+ } else {
2278
+ const matchQuery = db("search").select("search.entity_id").whereIn("key", textFilterFields).andWhere(function keyFilter() {
2279
+ this.andWhereRaw(
2280
+ "value like ?",
2281
+ `%${normalizedFullTextFilterTerm.toLocaleLowerCase("en-US")}%`
2282
+ );
2283
+ });
2284
+ dbQuery.andWhere("search.entity_id", "in", matchQuery);
2285
+ }
2275
2286
  }
2276
2287
  const countQuery = dbQuery.clone();
2277
2288
  const isOrderingDescending = sortField.order === "desc";