@unchainedshop/core-products 4.8.10 → 4.8.11
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/lib/db/ProductMediaCollection.js +4 -1
- package/lib/db/ProductReviewsCollection.js +14 -16
- package/lib/db/ProductVariationsCollection.js +1 -1
- package/lib/db/ProductsCollection.js +22 -27
- package/lib/module/configureProductReviewsModule.js +1 -2
- package/lib/module/configureProductsModule.js +1 -2
- package/package.json +1 -1
|
@@ -8,7 +8,10 @@ export const ProductMediaCollection = async (db) => {
|
|
|
8
8
|
{ index: { tags: 1, sortKey: 1 } },
|
|
9
9
|
{ index: { productId: 1, tags: 1, sortKey: 1 } },
|
|
10
10
|
]);
|
|
11
|
-
await buildDbIndexes(ProductMediaTexts, [
|
|
11
|
+
await buildDbIndexes(ProductMediaTexts, [
|
|
12
|
+
{ index: { productMediaId: 1 } },
|
|
13
|
+
{ index: { locale: 1, productMediaId: 1 } },
|
|
14
|
+
]);
|
|
12
15
|
return {
|
|
13
16
|
ProductMedias,
|
|
14
17
|
ProductMediaTexts,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mongodb, buildDbIndexes
|
|
1
|
+
import { mongodb, buildDbIndexes } from '@unchainedshop/mongodb';
|
|
2
2
|
export const ProductReviewVoteType = {
|
|
3
3
|
UPVOTE: 'UPVOTE',
|
|
4
4
|
DOWNVOTE: 'DOWNVOTE',
|
|
@@ -6,23 +6,21 @@ export const ProductReviewVoteType = {
|
|
|
6
6
|
};
|
|
7
7
|
export const ProductReviewsCollection = async (db) => {
|
|
8
8
|
const ProductReviews = db.collection('product_reviews');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
{
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
review: 5,
|
|
20
|
-
},
|
|
21
|
-
name: 'productreview_fulltext_search',
|
|
9
|
+
await buildDbIndexes(ProductReviews, [
|
|
10
|
+
{
|
|
11
|
+
index: {
|
|
12
|
+
title: 'text',
|
|
13
|
+
review: 'text',
|
|
14
|
+
},
|
|
15
|
+
options: {
|
|
16
|
+
weights: {
|
|
17
|
+
title: 3,
|
|
18
|
+
review: 5,
|
|
22
19
|
},
|
|
20
|
+
name: 'productreview_fulltext_search',
|
|
23
21
|
},
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
},
|
|
23
|
+
]);
|
|
26
24
|
await buildDbIndexes(ProductReviews, [{ index: { productId: 1 } }, { index: { authorId: 1 } }]);
|
|
27
25
|
return {
|
|
28
26
|
ProductReviews,
|
|
@@ -9,7 +9,7 @@ export const ProductVariationsCollection = async (db) => {
|
|
|
9
9
|
await buildDbIndexes(ProductVariations, [{ index: { productId: 1 } }]);
|
|
10
10
|
await buildDbIndexes(ProductVariationTexts, [
|
|
11
11
|
{ index: { productVariationId: 1 } },
|
|
12
|
-
{ index: { locale: 1 } },
|
|
12
|
+
{ index: { locale: 1, productVariationId: 1 } },
|
|
13
13
|
]);
|
|
14
14
|
return {
|
|
15
15
|
ProductVariations,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mongodb, buildDbIndexes
|
|
1
|
+
import { mongodb, buildDbIndexes } from '@unchainedshop/mongodb';
|
|
2
2
|
export const ProductStatus = {
|
|
3
3
|
DRAFT: 'DRAFT',
|
|
4
4
|
ACTIVE: 'ACTIVE',
|
|
@@ -18,41 +18,36 @@ export const ProductContractStandard = {
|
|
|
18
18
|
export const ProductsCollection = async (db) => {
|
|
19
19
|
const Products = db.collection('products');
|
|
20
20
|
const ProductTexts = db.collection('product_texts');
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
name: 'products_fulltext_search',
|
|
27
|
-
},
|
|
21
|
+
await buildDbIndexes(Products, [
|
|
22
|
+
{
|
|
23
|
+
index: { 'warehousing.sku': 'text', slugs: 'text' },
|
|
24
|
+
options: {
|
|
25
|
+
name: 'products_fulltext_search',
|
|
28
26
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
name: 'product_texts_fulltext_search',
|
|
27
|
+
},
|
|
28
|
+
]);
|
|
29
|
+
await buildDbIndexes(ProductTexts, [
|
|
30
|
+
{
|
|
31
|
+
index: { title: 'text', subtitle: 'text', vendor: 'text', brand: 'text' },
|
|
32
|
+
options: {
|
|
33
|
+
weights: {
|
|
34
|
+
title: 8,
|
|
35
|
+
subtitle: 6,
|
|
36
|
+
vendor: 5,
|
|
37
|
+
brand: 4,
|
|
41
38
|
},
|
|
39
|
+
name: 'product_texts_fulltext_search',
|
|
42
40
|
},
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
},
|
|
42
|
+
]);
|
|
45
43
|
await buildDbIndexes(Products, [
|
|
46
|
-
{ index: { deleted: 1 } },
|
|
47
|
-
{ index: { sequence: 1 } },
|
|
44
|
+
{ index: { deleted: 1, status: 1, sequence: 1 } },
|
|
48
45
|
{ index: { slugs: 1 } },
|
|
49
|
-
{ index: { status: 1 } },
|
|
50
46
|
{ index: { tags: 1 } },
|
|
51
|
-
{ index: { 'warehousing.sku': 1 } },
|
|
47
|
+
{ index: { 'warehousing.sku': 1 }, options: { sparse: true } },
|
|
52
48
|
]);
|
|
53
49
|
await buildDbIndexes(ProductTexts, [
|
|
54
50
|
{ index: { productId: 1 } },
|
|
55
|
-
{ index: { locale: 1 } },
|
|
56
51
|
{ index: { slug: 1 } },
|
|
57
52
|
{ index: { locale: 1, productId: 1 } },
|
|
58
53
|
]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {} from '@unchainedshop/mongodb';
|
|
2
2
|
import { emit, registerEvents } from '@unchainedshop/events';
|
|
3
3
|
import { generateDbFilterById, buildSortOptions, mongodb, generateDbObjectId, } from '@unchainedshop/mongodb';
|
|
4
4
|
import { SortDirection } from '@unchainedshop/utils';
|
|
@@ -17,7 +17,6 @@ const buildFindSelector = ({ productId, authorId, queryString, created, updated,
|
|
|
17
17
|
deleted: null,
|
|
18
18
|
};
|
|
19
19
|
if (queryString) {
|
|
20
|
-
assertDocumentDBCompatMode();
|
|
21
20
|
selector.$text = { $search: queryString };
|
|
22
21
|
}
|
|
23
22
|
if (created) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { emit, registerEvents } from '@unchainedshop/events';
|
|
2
|
-
import { findPreservingIds, generateDbFilterById, buildSortOptions, mongodb, generateDbObjectId,
|
|
2
|
+
import { findPreservingIds, generateDbFilterById, buildSortOptions, mongodb, generateDbObjectId, } from '@unchainedshop/mongodb';
|
|
3
3
|
import { SortDirection } from '@unchainedshop/utils';
|
|
4
4
|
import { ProductsCollection, ProductStatus, ProductType, } from "../db/ProductsCollection.js";
|
|
5
5
|
import { configureProductMediaModule } from "./configureProductMediaModule.js";
|
|
@@ -53,7 +53,6 @@ export const buildFindSelector = ({ slugs, tags, includeDrafts = false, includeD
|
|
|
53
53
|
selector.$or = orConditions;
|
|
54
54
|
}
|
|
55
55
|
if (queryString && !selector.$text) {
|
|
56
|
-
assertDocumentDBCompatMode();
|
|
57
56
|
selector.$text = { $search: queryString };
|
|
58
57
|
}
|
|
59
58
|
if (!selector.status) {
|
package/package.json
CHANGED