@blaze-cms/react-page-builder 0.140.0 → 0.140.1-core-styles.0
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 +11 -0
- package/README.md +3 -0
- package/lib/helpers/build-search-values-text.js +4 -2
- package/lib/helpers/build-search-values-text.js.map +1 -1
- package/lib-es/helpers/build-search-values-text.js +4 -2
- package/lib-es/helpers/build-search-values-text.js.map +1 -1
- package/package.json +10 -10
- package/src/helpers/build-search-values-text.js +4 -2
- package/tests/unit/src/helpers/build-search-values-text.test.js +9 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.140.1-core-styles.0](https://github.com/thebyte9/blaze/compare/v0.140.0...v0.140.1-core-styles.0) (2024-03-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* added prefix_length to fuzzy querys ([#4278](https://github.com/thebyte9/blaze/issues/4278)) ([887cc4f](https://github.com/thebyte9/blaze/commit/887cc4f5b669cbe3c597cd8cd9bf050e30767b47))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [0.140.0](https://github.com/thebyte9/blaze/compare/v0.140.0-alpha.0...v0.140.0) (2024-03-01)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @blaze-cms/react-page-builder
|
package/README.md
CHANGED
|
@@ -248,6 +248,9 @@ If the query param is a string, it can be checkbox, range or select. For the ran
|
|
|
248
248
|
## buildSearchValuesText
|
|
249
249
|
|
|
250
250
|
Returns array with correctly built text search filter values in the format for ELKS.
|
|
251
|
+
The search filter values will always have the following es options `fuzziness: 'AUTO', prefix_length: 3`.
|
|
252
|
+
`fuzzines: AUTO` allows for the search text to be edited for circumventing typos
|
|
253
|
+
`prefix_length: 3` leaves the beginning characters unchanged to have more acurate results
|
|
251
254
|
|
|
252
255
|
## buildSetFilters
|
|
253
256
|
|
|
@@ -22,7 +22,8 @@ var buildSearchValuesText = function buildSearchValuesText() {
|
|
|
22
22
|
match: {
|
|
23
23
|
pageBuilderIndexed: {
|
|
24
24
|
query: searchTerm,
|
|
25
|
-
fuzziness: 'AUTO'
|
|
25
|
+
fuzziness: 'AUTO',
|
|
26
|
+
prefix_length: 3
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
});
|
|
@@ -30,7 +31,8 @@ var buildSearchValuesText = function buildSearchValuesText() {
|
|
|
30
31
|
acc.must.push({
|
|
31
32
|
match: (0, _defineProperty2["default"])({}, field, {
|
|
32
33
|
query: searchTerm,
|
|
33
|
-
fuzziness: 'AUTO'
|
|
34
|
+
fuzziness: 'AUTO',
|
|
35
|
+
prefix_length: 3
|
|
34
36
|
})
|
|
35
37
|
});
|
|
36
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-search-values-text.js","names":["buildSearchValuesText","_ref","arguments","length","undefined","_ref$propsToDisplay","propsToDisplay","_ref2","searchTerm","search_term","reduce","acc","field","index","should","push","match","pageBuilderIndexed","query","fuzziness","must","_defineProperty2","_default","exports"],"sources":["../../src/helpers/build-search-values-text.js"],"sourcesContent":["const buildSearchValuesText = ({ propsToDisplay = [] } = {}, { search_term: searchTerm } = {}) =>\n propsToDisplay.reduce(\n (acc, field, index) => {\n if (field && searchTerm) {\n if (index === 0) {\n acc.should.push({\n match: {\n pageBuilderIndexed: {\n query: searchTerm,\n fuzziness: 'AUTO'\n }\n }\n });\n }\n acc.must.push({\n match: {\n [field]: {\n query: searchTerm,\n fuzziness: 'AUTO'\n }\n }\n });\n }\n return acc;\n },\n { should: [], must: [] }\n );\n\nexport default buildSearchValuesText;\n"],"mappings":";;;;;;;;;;;AAAA,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAA;EAAA,IAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAA8B,CAAC,CAAC;IAAAG,mBAAA,GAAAJ,IAAA,CAA1BK,cAAc;IAAdA,cAAc,GAAAD,mBAAA,cAAG,EAAE,GAAAA,mBAAA;EAAA,IAAAE,KAAA,GAAAL,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAuC,CAAC,CAAC;IAAjBM,UAAU,GAAAD,KAAA,CAAvBE,WAAW;EAAA,OACxEH,cAAc,CAACI,MAAM,CACnB,UAACC,GAAG,EAAEC,KAAK,EAAEC,KAAK,EAAK;IACrB,IAAID,KAAK,IAAIJ,UAAU,EAAE;MACvB,IAAIK,KAAK,KAAK,CAAC,EAAE;QACfF,GAAG,CAACG,MAAM,CAACC,IAAI,CAAC;UACdC,KAAK,EAAE;YACLC,kBAAkB,EAAE;cAClBC,KAAK,EAAEV,UAAU;cACjBW,SAAS,EAAE;
|
|
1
|
+
{"version":3,"file":"build-search-values-text.js","names":["buildSearchValuesText","_ref","arguments","length","undefined","_ref$propsToDisplay","propsToDisplay","_ref2","searchTerm","search_term","reduce","acc","field","index","should","push","match","pageBuilderIndexed","query","fuzziness","prefix_length","must","_defineProperty2","_default","exports"],"sources":["../../src/helpers/build-search-values-text.js"],"sourcesContent":["const buildSearchValuesText = ({ propsToDisplay = [] } = {}, { search_term: searchTerm } = {}) =>\n propsToDisplay.reduce(\n (acc, field, index) => {\n if (field && searchTerm) {\n if (index === 0) {\n acc.should.push({\n match: {\n pageBuilderIndexed: {\n query: searchTerm,\n fuzziness: 'AUTO',\n prefix_length: 3\n }\n }\n });\n }\n acc.must.push({\n match: {\n [field]: {\n query: searchTerm,\n fuzziness: 'AUTO',\n prefix_length: 3\n }\n }\n });\n }\n return acc;\n },\n { should: [], must: [] }\n );\n\nexport default buildSearchValuesText;\n"],"mappings":";;;;;;;;;;;AAAA,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
|
+
fuzziness: 'AUTO',
|
|
13
|
+
prefix_length: 3
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
});
|
|
@@ -18,7 +19,8 @@ const buildSearchValuesText = ({
|
|
|
18
19
|
match: {
|
|
19
20
|
[field]: {
|
|
20
21
|
query: searchTerm,
|
|
21
|
-
fuzziness: 'AUTO'
|
|
22
|
+
fuzziness: 'AUTO',
|
|
23
|
+
prefix_length: 3
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-search-values-text.js","names":["buildSearchValuesText","propsToDisplay","search_term","searchTerm","reduce","acc","field","index","should","push","match","pageBuilderIndexed","query","fuzziness","must"],"sources":["../../src/helpers/build-search-values-text.js"],"sourcesContent":["const buildSearchValuesText = ({ propsToDisplay = [] } = {}, { search_term: searchTerm } = {}) =>\n propsToDisplay.reduce(\n (acc, field, index) => {\n if (field && searchTerm) {\n if (index === 0) {\n acc.should.push({\n match: {\n pageBuilderIndexed: {\n query: searchTerm,\n fuzziness: 'AUTO'\n }\n }\n });\n }\n acc.must.push({\n match: {\n [field]: {\n query: searchTerm,\n fuzziness: 'AUTO'\n }\n }\n });\n }\n return acc;\n },\n { should: [], must: [] }\n );\n\nexport default buildSearchValuesText;\n"],"mappings":"AAAA,MAAMA,qBAAqB,GAAGA,CAAC;EAAEC,cAAc,GAAG;AAAG,CAAC,GAAG,CAAC,CAAC,EAAE;EAAEC,WAAW,EAAEC;AAAW,CAAC,GAAG,CAAC,CAAC,KAC3FF,cAAc,CAACG,MAAM,CACnB,CAACC,GAAG,EAAEC,KAAK,EAAEC,KAAK,KAAK;EACrB,IAAID,KAAK,IAAIH,UAAU,EAAE;IACvB,IAAII,KAAK,KAAK,CAAC,EAAE;MACfF,GAAG,CAACG,MAAM,CAACC,IAAI,CAAC;QACdC,KAAK,EAAE;UACLC,kBAAkB,EAAE;YAClBC,KAAK,EAAET,UAAU;YACjBU,SAAS,EAAE;
|
|
1
|
+
{"version":3,"file":"build-search-values-text.js","names":["buildSearchValuesText","propsToDisplay","search_term","searchTerm","reduce","acc","field","index","should","push","match","pageBuilderIndexed","query","fuzziness","prefix_length","must"],"sources":["../../src/helpers/build-search-values-text.js"],"sourcesContent":["const buildSearchValuesText = ({ propsToDisplay = [] } = {}, { search_term: searchTerm } = {}) =>\n propsToDisplay.reduce(\n (acc, field, index) => {\n if (field && searchTerm) {\n if (index === 0) {\n acc.should.push({\n match: {\n pageBuilderIndexed: {\n query: searchTerm,\n fuzziness: 'AUTO',\n prefix_length: 3\n }\n }\n });\n }\n acc.must.push({\n match: {\n [field]: {\n query: searchTerm,\n fuzziness: 'AUTO',\n prefix_length: 3\n }\n }\n });\n }\n return acc;\n },\n { should: [], must: [] }\n );\n\nexport default buildSearchValuesText;\n"],"mappings":"AAAA,MAAMA,qBAAqB,GAAGA,CAAC;EAAEC,cAAc,GAAG;AAAG,CAAC,GAAG,CAAC,CAAC,EAAE;EAAEC,WAAW,EAAEC;AAAW,CAAC,GAAG,CAAC,CAAC,KAC3FF,cAAc,CAACG,MAAM,CACnB,CAACC,GAAG,EAAEC,KAAK,EAAEC,KAAK,KAAK;EACrB,IAAID,KAAK,IAAIH,UAAU,EAAE;IACvB,IAAII,KAAK,KAAK,CAAC,EAAE;MACfF,GAAG,CAACG,MAAM,CAACC,IAAI,CAAC;QACdC,KAAK,EAAE;UACLC,kBAAkB,EAAE;YAClBC,KAAK,EAAET,UAAU;YACjBU,SAAS,EAAE,MAAM;YACjBC,aAAa,EAAE;UACjB;QACF;MACF,CAAC,CAAC;IACJ;IACAT,GAAG,CAACU,IAAI,CAACN,IAAI,CAAC;MACZC,KAAK,EAAE;QACL,CAACJ,KAAK,GAAG;UACPM,KAAK,EAAET,UAAU;UACjBU,SAAS,EAAE,MAAM;UACjBC,aAAa,EAAE;QACjB;MACF;IACF,CAAC,CAAC;EACJ;EACA,OAAOT,GAAG;AACZ,CAAC,EACD;EAAEG,MAAM,EAAE,EAAE;EAAEO,IAAI,EAAE;AAAG,CACzB,CAAC;AAEH,eAAef,qBAAqB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/react-page-builder",
|
|
3
|
-
"version": "0.140.0",
|
|
3
|
+
"version": "0.140.1-core-styles.0",
|
|
4
4
|
"description": "Blaze react page builder",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
},
|
|
28
28
|
"license": "GPL-3.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@blaze-cms/core-auth-ui": "
|
|
31
|
-
"@blaze-cms/core-errors": "
|
|
32
|
-
"@blaze-cms/core-errors-ui": "
|
|
30
|
+
"@blaze-cms/core-auth-ui": "0.140.1-core-styles.0",
|
|
31
|
+
"@blaze-cms/core-errors": "0.140.1-core-styles.0",
|
|
32
|
+
"@blaze-cms/core-errors-ui": "0.140.1-core-styles.0",
|
|
33
33
|
"@blaze-cms/image-cdn-react": "0.3.0-alpha.6",
|
|
34
|
-
"@blaze-cms/nextjs-components": "
|
|
35
|
-
"@blaze-cms/plugin-search-ui": "
|
|
36
|
-
"@blaze-cms/setup-ui": "
|
|
37
|
-
"@blaze-cms/utils": "
|
|
38
|
-
"@blaze-cms/utils-handlebars": "
|
|
34
|
+
"@blaze-cms/nextjs-components": "0.140.1-core-styles.0",
|
|
35
|
+
"@blaze-cms/plugin-search-ui": "0.140.1-core-styles.0",
|
|
36
|
+
"@blaze-cms/setup-ui": "0.140.1-core-styles.0",
|
|
37
|
+
"@blaze-cms/utils": "0.140.1-core-styles.0",
|
|
38
|
+
"@blaze-cms/utils-handlebars": "0.140.1-core-styles.0",
|
|
39
39
|
"@blaze-react/breadcrumb": "0.8.0-alpha.60",
|
|
40
40
|
"@blaze-react/button": "0.5.19",
|
|
41
41
|
"@blaze-react/checkboxes": "0.5.31",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"lib/*",
|
|
90
90
|
"lib-es/*"
|
|
91
91
|
],
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "ce6341ba8f78b3250784812367e0fd4cac17c270"
|
|
93
93
|
}
|
|
@@ -7,7 +7,8 @@ const buildSearchValuesText = ({ propsToDisplay = [] } = {}, { search_term: sear
|
|
|
7
7
|
match: {
|
|
8
8
|
pageBuilderIndexed: {
|
|
9
9
|
query: searchTerm,
|
|
10
|
-
fuzziness: 'AUTO'
|
|
10
|
+
fuzziness: 'AUTO',
|
|
11
|
+
prefix_length: 3
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
});
|
|
@@ -16,7 +17,8 @@ const buildSearchValuesText = ({ propsToDisplay = [] } = {}, { search_term: sear
|
|
|
16
17
|
match: {
|
|
17
18
|
[field]: {
|
|
18
19
|
query: searchTerm,
|
|
19
|
-
fuzziness: 'AUTO'
|
|
20
|
+
fuzziness: 'AUTO',
|
|
21
|
+
prefix_length: 3
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
});
|
|
@@ -32,18 +32,20 @@ describe('build search values for text input', () => {
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
it('should have no filters set', () => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
expect(searchValuesEmpty.must.length).toEqual(0);
|
|
38
|
-
});
|
|
35
|
+
expect(searchValuesEmpty.should.length).toEqual(0);
|
|
36
|
+
expect(searchValuesEmpty.must.length).toEqual(0);
|
|
39
37
|
});
|
|
40
38
|
|
|
41
39
|
it('should return an array with correct data', () => {
|
|
42
40
|
const searchArray = {
|
|
43
|
-
should: [
|
|
41
|
+
should: [
|
|
42
|
+
{
|
|
43
|
+
match: { pageBuilderIndexed: { query: 'something', fuzziness: 'AUTO', prefix_length: 3 } }
|
|
44
|
+
}
|
|
45
|
+
],
|
|
44
46
|
must: [
|
|
45
|
-
{ match: { name: { query: 'something', fuzziness: 'AUTO' } } },
|
|
46
|
-
{ match: { metaTitle: { query: 'something', fuzziness: 'AUTO' } } }
|
|
47
|
+
{ match: { name: { query: 'something', fuzziness: 'AUTO', prefix_length: 3 } } },
|
|
48
|
+
{ match: { metaTitle: { query: 'something', fuzziness: 'AUTO', prefix_length: 3 } } }
|
|
47
49
|
]
|
|
48
50
|
};
|
|
49
51
|
expect(searchValues).toEqual(searchArray);
|