@infrab4a/connect 4.9.4-beta.2 → 4.9.4-beta.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/index.cjs.js CHANGED
@@ -2647,12 +2647,12 @@ class ProductsIndex {
2647
2647
  match_phrase: {
2648
2648
  name: {
2649
2649
  query: `${searchTerm}`,
2650
- boost: 3,
2650
+ boost: 4,
2651
2651
  },
2652
2652
  },
2653
2653
  },
2654
2654
  {
2655
- match: {
2655
+ match_phrase: {
2656
2656
  brand: {
2657
2657
  query: `${searchTerm}`,
2658
2658
  boost: 2,
@@ -2665,19 +2665,19 @@ class ProductsIndex {
2665
2665
  const complementSearch = searchTerm.split(' ');
2666
2666
  if (complementSearch.length > 1) {
2667
2667
  query.should.push({
2668
+ multi_match: {
2669
+ query: `${searchTerm}`,
2670
+ fields: ['name'],
2671
+ operator: 'AND',
2672
+ boost: 3,
2673
+ },
2674
+ }, {
2668
2675
  match_phrase: {
2669
2676
  name: {
2670
2677
  query: `${complementSearch.shift()}`,
2671
2678
  boost: 1,
2672
2679
  },
2673
2680
  },
2674
- }, {
2675
- multi_match: {
2676
- query: `${searchTerm}`,
2677
- fields: ['name'],
2678
- operator: 'AND',
2679
- boost: 2,
2680
- },
2681
2681
  });
2682
2682
  }
2683
2683
  const search = await this.adapter.query(this.index, {
@@ -2686,40 +2686,6 @@ class ProductsIndex {
2686
2686
  _source: fields,
2687
2687
  query: {
2688
2688
  bool: query,
2689
- // {
2690
- // should: [
2691
- // {
2692
- // multi_match: {
2693
- // query: `${searchTerm}`,
2694
- // fields: ['name', 'name.folded', 'name.search'],
2695
- // operator: 'AND',
2696
- // },
2697
- // },
2698
- // {
2699
- // match_phrase: {
2700
- // name: {
2701
- // query: `${searchTerm}`,
2702
- // boost: 2,
2703
- // },
2704
- // },
2705
- // },
2706
- // {
2707
- // match: {
2708
- // brand: {
2709
- // query: `${searchTerm}`,
2710
- // },
2711
- // },
2712
- // },
2713
- // {
2714
- // multi_match: {
2715
- // query: `${searchTerm}`,
2716
- // fields: ['name', 'name.folded', 'name.search'],
2717
- // operator: 'OR',
2718
- // },
2719
- // },
2720
- // ],
2721
- // filter,
2722
- // },
2723
2689
  },
2724
2690
  });
2725
2691
  search.hits = search.hits
@@ -2935,7 +2901,7 @@ const withGetFirestore = (MixinBase) => {
2935
2901
  .get();
2936
2902
  const data = docRef.data();
2937
2903
  if (lodash.isNil(data))
2938
- throw new NotFoundError(`Document ${JSON.stringify(identifiers)} not found`);
2904
+ throw new NotFoundError(`Document '${collectionName}/${JSON.stringify(identifiers)}' not found`);
2939
2905
  const res = ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.call(_c, data, intercepted)) || data;
2940
2906
  logger.log({ req, res });
2941
2907
  return res;
package/index.esm.js CHANGED
@@ -2623,12 +2623,12 @@ class ProductsIndex {
2623
2623
  match_phrase: {
2624
2624
  name: {
2625
2625
  query: `${searchTerm}`,
2626
- boost: 3,
2626
+ boost: 4,
2627
2627
  },
2628
2628
  },
2629
2629
  },
2630
2630
  {
2631
- match: {
2631
+ match_phrase: {
2632
2632
  brand: {
2633
2633
  query: `${searchTerm}`,
2634
2634
  boost: 2,
@@ -2641,19 +2641,19 @@ class ProductsIndex {
2641
2641
  const complementSearch = searchTerm.split(' ');
2642
2642
  if (complementSearch.length > 1) {
2643
2643
  query.should.push({
2644
+ multi_match: {
2645
+ query: `${searchTerm}`,
2646
+ fields: ['name'],
2647
+ operator: 'AND',
2648
+ boost: 3,
2649
+ },
2650
+ }, {
2644
2651
  match_phrase: {
2645
2652
  name: {
2646
2653
  query: `${complementSearch.shift()}`,
2647
2654
  boost: 1,
2648
2655
  },
2649
2656
  },
2650
- }, {
2651
- multi_match: {
2652
- query: `${searchTerm}`,
2653
- fields: ['name'],
2654
- operator: 'AND',
2655
- boost: 2,
2656
- },
2657
2657
  });
2658
2658
  }
2659
2659
  const search = await this.adapter.query(this.index, {
@@ -2662,40 +2662,6 @@ class ProductsIndex {
2662
2662
  _source: fields,
2663
2663
  query: {
2664
2664
  bool: query,
2665
- // {
2666
- // should: [
2667
- // {
2668
- // multi_match: {
2669
- // query: `${searchTerm}`,
2670
- // fields: ['name', 'name.folded', 'name.search'],
2671
- // operator: 'AND',
2672
- // },
2673
- // },
2674
- // {
2675
- // match_phrase: {
2676
- // name: {
2677
- // query: `${searchTerm}`,
2678
- // boost: 2,
2679
- // },
2680
- // },
2681
- // },
2682
- // {
2683
- // match: {
2684
- // brand: {
2685
- // query: `${searchTerm}`,
2686
- // },
2687
- // },
2688
- // },
2689
- // {
2690
- // multi_match: {
2691
- // query: `${searchTerm}`,
2692
- // fields: ['name', 'name.folded', 'name.search'],
2693
- // operator: 'OR',
2694
- // },
2695
- // },
2696
- // ],
2697
- // filter,
2698
- // },
2699
2665
  },
2700
2666
  });
2701
2667
  search.hits = search.hits
@@ -2911,7 +2877,7 @@ const withGetFirestore = (MixinBase) => {
2911
2877
  .get();
2912
2878
  const data = docRef.data();
2913
2879
  if (isNil(data))
2914
- throw new NotFoundError(`Document ${JSON.stringify(identifiers)} not found`);
2880
+ throw new NotFoundError(`Document '${collectionName}/${JSON.stringify(identifiers)}' not found`);
2915
2881
  const res = ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.call(_c, data, intercepted)) || data;
2916
2882
  logger.log({ req, res });
2917
2883
  return res;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "4.9.4-beta.2",
3
+ "version": "4.9.4-beta.4",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -5,7 +5,7 @@ import { FirestoreRepository, FirestoreSubRepository } from '../types';
5
5
  export declare const withHelpers: <TMixinBase extends MixinCtor<any, any[]> = MixinCtor<any, any[]>>(MixinBase: MixinCtor<any, any[]> & TMixinBase) => {
6
6
  new (...args: any[]): {
7
7
  [x: string]: any;
8
- toArray<T extends ModelBaseStructure<T, T["identifiersFields"][number]>>(snapShot: QuerySnapshot<T> | QueryDocumentSnapshot<T>[]): T[];
8
+ toArray<T extends ModelBaseStructure<T, T["identifiersFields"][number]>>(snapShot: QuerySnapshot<T, import("firebase/firestore").DocumentData> | QueryDocumentSnapshot<T, import("firebase/firestore").DocumentData>[]): T[];
9
9
  isSubCollection<T_1 extends ModelBaseStructure<T_1, T_1["identifiersFields"][number]>, E extends ModelBaseStructure<E, E["identifiersFields"][number]>>(repository: FirestoreRepository<T_1> | FirestoreSubRepository<T_1, E>): repository is FirestoreSubRepository<T_1, E>;
10
10
  };
11
11
  } & TMixinBase;