@open-xamu-co/firebase-nuxt 2.0.0-next.4 → 2.0.0-next.6

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,19 @@
1
1
  Firebase nuxt
2
2
 
3
+ # [2.0.0-next.6](https://github.com/xamu-co/firebase-nuxt/compare/v2.0.0-next.5...v2.0.0-next.6) (2026-01-20)
4
+
5
+
6
+ ### Features
7
+
8
+ * generate weighted search indexes ([36fdabc](https://github.com/xamu-co/firebase-nuxt/commit/36fdabc0ed5060813f2abf3aa748f023d9d3bb8f))
9
+
10
+ # [2.0.0-next.5](https://github.com/xamu-co/firebase-nuxt/compare/v2.0.0-next.4...v2.0.0-next.5) (2026-01-20)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * bump for mapNodes priority ([08df299](https://github.com/xamu-co/firebase-nuxt/commit/08df29970297b82830253dfdd1920a1e9afd8f13))
16
+
3
17
  # [2.0.0-next.4](https://github.com/xamu-co/firebase-nuxt/compare/v2.0.0-next.3...v2.0.0-next.4) (2026-01-20)
4
18
 
5
19
 
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "2.0.0-next.3",
7
+ "version": "2.0.0-next.5",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -11,5 +11,25 @@ export declare function getWords(phrase: string): string[];
11
11
  export declare function soundexEs(phrase: string): string;
12
12
  /**
13
13
  * Generate indexes to be used as tokens in a fuzzy search
14
+ *
15
+ * Indexes allow to search for a phrase in a fuzzy way
16
+ *
17
+ * @param phrase phrase to generate indexes for
18
+ * @param soundexAlgorithm soundex algorithm to use
19
+ * @returns array of indexes
14
20
  */
15
21
  export declare function getSearchIndexes(phrase: string, soundexAlgorithm?: (phrase: string) => string): string[];
22
+ /**
23
+ * Generate indexes to be used as tokens in a fuzzy search
24
+ *
25
+ * Indexes allow to search for a phrase in a fuzzy way
26
+ * Weights allow to sort results based on their relevance
27
+ *
28
+ * @param phrase phrase to generate indexes for
29
+ * @param soundexAlgorithm soundex algorithm to use
30
+ * @returns array of objects with index and weight
31
+ */
32
+ export declare function getWeightedSearchIndexes(phrase: string, soundexAlgorithm?: (phrase: string) => string): {
33
+ indexes: string[];
34
+ indexesWeights: string[];
35
+ };
@@ -16,23 +16,33 @@ export function soundexEs(phrase) {
16
16
  return (firstLetter + rest).padEnd(4, "0").slice(0, 4);
17
17
  }
18
18
  export function getSearchIndexes(phrase, soundexAlgorithm = soundexEs) {
19
+ return getWeightedSearchIndexes(phrase, soundexAlgorithm).indexes;
20
+ }
21
+ export function getWeightedSearchIndexes(phrase, soundexAlgorithm = soundexEs) {
19
22
  const words2 = getWords(phrase);
20
23
  const indexes = /* @__PURE__ */ new Set();
24
+ const weights = /* @__PURE__ */ new Set();
21
25
  for (let i = 0; i < words2.length; i++) {
22
26
  const forwardWords = words2.slice(0, words2.length - i);
23
27
  const backwardWords = words2.slice(i);
24
28
  [forwardWords, backwardWords].forEach((currentWords) => {
25
- const perPhraseIndex = soundexAlgorithm(currentWords.join(" "));
26
- const perWordIndex = currentWords.map((word) => {
29
+ const phraseIndex = soundexAlgorithm(currentWords.join(" "));
30
+ indexes.add(phraseIndex);
31
+ weights.add(`0:${phraseIndex}`);
32
+ currentWords.forEach((word) => {
33
+ const wordIndex = soundexAlgorithm(word);
34
+ indexes.add(wordIndex);
35
+ weights.add(`1:${wordIndex}`);
27
36
  if (word.length >= 7) {
28
- const threeIndex = soundexAlgorithm(word.slice(0, 3));
29
37
  const fiveIndex = soundexAlgorithm(word.slice(0, 5));
30
- indexes.add(threeIndex).add(fiveIndex);
38
+ const threeIndex = soundexAlgorithm(word.slice(0, 3));
39
+ indexes.add(fiveIndex);
40
+ weights.add(`2:${fiveIndex}`);
41
+ indexes.add(threeIndex);
42
+ weights.add(`3:${threeIndex}`);
31
43
  }
32
- return soundexAlgorithm(word);
33
- }).join(" ");
34
- indexes.add(perPhraseIndex).add(perWordIndex);
44
+ });
35
45
  });
36
46
  }
37
- return Array.from(indexes);
47
+ return { indexes: Array.from(indexes), indexesWeights: Array.from(weights) };
38
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-xamu-co/firebase-nuxt",
3
- "version": "2.0.0-next.4",
3
+ "version": "2.0.0-next.6",
4
4
  "stableVersion": "1.1.0",
5
5
  "description": "Nuxt 3 module for the xamu project",
6
6
  "author": "@xamu-co",
@@ -87,7 +87,7 @@
87
87
  "@nuxt/kit": "^3.20.2",
88
88
  "@open-xamu-co/ui-common-enums": "^4.0.0-next.2",
89
89
  "@open-xamu-co/ui-common-helpers": "^4.0.0-next.4",
90
- "@open-xamu-co/ui-components-vue": "^4.0.0-next.6",
90
+ "@open-xamu-co/ui-components-vue": "^4.0.0-next.7",
91
91
  "@open-xamu-co/ui-nuxt": "^4.0.0-next.7",
92
92
  "@pinia/nuxt": "^0.11.0",
93
93
  "accept-language-parser": "^1.5.0",