@infrab4a/connect-angular 4.10.0-beta.4 → 4.10.0-beta.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/esm2020/services/catalog/catalog.service.mjs +7 -20
- package/fesm2015/infrab4a-connect-angular.mjs +6 -19
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +6 -19
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1675,10 +1675,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1675
1675
|
}] }]; } });
|
|
1676
1676
|
|
|
1677
1677
|
class CatalogService {
|
|
1678
|
-
constructor(productRepository, productStockNotificationRepository, categoryRepository, categoryStructureAdapter, shop,
|
|
1679
|
-
// private readonly productIndex: ProductsIndex,
|
|
1680
|
-
// private readonly productVertexSearch: ProductsVertexSearch,
|
|
1681
|
-
productSearch) {
|
|
1678
|
+
constructor(productRepository, productStockNotificationRepository, categoryRepository, categoryStructureAdapter, shop, productSearch) {
|
|
1682
1679
|
this.productRepository = productRepository;
|
|
1683
1680
|
this.productStockNotificationRepository = productStockNotificationRepository;
|
|
1684
1681
|
this.categoryRepository = categoryRepository;
|
|
@@ -1765,7 +1762,8 @@ class CatalogService {
|
|
|
1765
1762
|
}
|
|
1766
1763
|
async findCatalog(options, limits) {
|
|
1767
1764
|
if (this.hasTerm(options) && options.sort === 'most-relevant') {
|
|
1768
|
-
|
|
1765
|
+
console.log('findCatalogIdsBySearch', options.term, options.perPage, options.perPage === 9);
|
|
1766
|
+
const productsIds = await this.findCatalogIdsBySearch(options.term, options.perPage === 9);
|
|
1769
1767
|
return this.findCatalogAndSortByMostRevelantByTerm(productsIds, options, limits);
|
|
1770
1768
|
}
|
|
1771
1769
|
if (this.hasCategory(options) && options.sort === 'most-relevant') {
|
|
@@ -1805,7 +1803,7 @@ class CatalogService {
|
|
|
1805
1803
|
return { tags: { operator: Where.LIKE, value: profile } };
|
|
1806
1804
|
if (term)
|
|
1807
1805
|
return this.productSearch
|
|
1808
|
-
.search(term, 999, this.shop)
|
|
1806
|
+
.search(term, 999, this.shop == Shops.GLAMSHOP ? 'female' : 'male')
|
|
1809
1807
|
.then((data) => ({ id: { operator: Where.IN, value: data.map((_source) => _source.id) } }));
|
|
1810
1808
|
}
|
|
1811
1809
|
async findCatalogAndSortByMostRevelant(mostRelevants, productIds, options, limits) {
|
|
@@ -1873,22 +1871,11 @@ class CatalogService {
|
|
|
1873
1871
|
distinct: totalResult.distinct,
|
|
1874
1872
|
};
|
|
1875
1873
|
}
|
|
1876
|
-
|
|
1877
|
-
// if (this.productsByTerm[term]) return this.productsByTerm[term]
|
|
1878
|
-
// return (this.productsByTerm[term] = await this.productSearch
|
|
1879
|
-
// .search<Product>(term, 999, this.shop)
|
|
1880
|
-
// .then((products) => {
|
|
1881
|
-
// const withStock = products.filter((_source) => _source.stock.quantity > 0)
|
|
1882
|
-
// const withOutStock = products.filter((_source) => _source.stock.quantity <= 0)
|
|
1883
|
-
// const sorted = [...withStock, ...withOutStock]
|
|
1884
|
-
// return [...new Set(sorted.map((_source) => _source.id))]
|
|
1885
|
-
// }))
|
|
1886
|
-
// }
|
|
1887
|
-
async findCatalogIdsBySearch(term) {
|
|
1874
|
+
async findCatalogIdsBySearch(term, preview) {
|
|
1888
1875
|
if (this.productsByTerm[term])
|
|
1889
1876
|
return this.productsByTerm[term];
|
|
1890
1877
|
return (this.productsByTerm[term] = await this.productSearch
|
|
1891
|
-
.search(term,
|
|
1878
|
+
.search(term, preview ? 9 : 9999, this.shop == Shops.GLAMSHOP ? 'female' : 'male')
|
|
1892
1879
|
.then((products) => {
|
|
1893
1880
|
const withStock = products.filter((_source) => _source.stock > 0);
|
|
1894
1881
|
const withOutStock = products.filter((_source) => _source.stock <= 0);
|