@eeplatform/core 1.8.3 → 1.8.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @eeplatform/core
2
2
 
3
+ ## 1.8.4
4
+
5
+ ### Patch Changes
6
+
7
+ - dd69528: Update PSGC query
8
+
3
9
  ## 1.8.3
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -7216,8 +7216,17 @@ function usePSGCRepo() {
7216
7216
  }
7217
7217
  }
7218
7218
  async function getByName({ name, prefix = "", type = "" } = {}) {
7219
- const query = { $text: { $search: name }, type };
7220
- const cacheKeyOptions = { name, type };
7219
+ const stopWords = /* @__PURE__ */ new Set(["of", "the"]);
7220
+ const words = name.trim().split(/\s+/).filter((w) => w.length > 2 && !stopWords.has(w.toLowerCase())).map((w) => w.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
7221
+ const regex = words.map((w) => `(?=.*${w})`).join("");
7222
+ const query = {
7223
+ name: { $regex: regex, $options: "i" }
7224
+ };
7225
+ const cacheKeyOptions = { type };
7226
+ if (type) {
7227
+ query.type = type;
7228
+ cacheKeyOptions.type = type;
7229
+ }
7221
7230
  const _types = ["City", "Mun"];
7222
7231
  if (_types.includes(type)) {
7223
7232
  query.type = { $in: _types };