@outliant/sunrise-utils 1.0.7 → 1.0.8

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
@@ -4,9 +4,17 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [1.0.8](https://github.com/outliant/sunrise-utils/compare/1.0.7...1.0.8)
8
+
9
+ - chore: use match_phrase_prefix [`#3`](https://github.com/outliant/sunrise-utils/pull/3)
10
+ - chore(#860q1ku0m): use match_phrase_prefix for fuzzy searching [`f607110`](https://github.com/outliant/sunrise-utils/commit/f607110d9071d02b0aeeb1a41dd0e8ee4b13d6f5)
11
+
7
12
  #### [1.0.7](https://github.com/outliant/sunrise-utils/compare/1.0.6...1.0.7)
8
13
 
14
+ > 9 March 2023
15
+
9
16
  - chore: support multiple sorting #860px39yc [`133144d`](https://github.com/outliant/sunrise-utils/commit/133144d805126d301543e1df50510b982ea0f130)
17
+ - chore(release): 1.0.7 [`617bf83`](https://github.com/outliant/sunrise-utils/commit/617bf83a2ac80e030b0a81e9cdce0bd719b9e27b)
10
18
 
11
19
  #### [1.0.6](https://github.com/outliant/sunrise-utils/compare/1.0.5...1.0.6)
12
20
 
@@ -1,11 +1,11 @@
1
1
  const moment = require('moment');
2
2
  const { escapeElasticQuery } = require('../es');
3
3
 
4
- function getContainsMappingValue (filter) {
4
+ function getContainsMappingValue(filter) {
5
5
  if (['text', 'textarea'].includes(filter.field_type)) {
6
6
  return {
7
7
  bool: {
8
- must: [
8
+ should: [
9
9
  {
10
10
  match: {
11
11
  [`fields.text.analyzed`]: {
@@ -13,6 +13,11 @@ function getContainsMappingValue (filter) {
13
13
  operator: 'and'
14
14
  }
15
15
  }
16
+ },
17
+ {
18
+ match_phrase_prefix: {
19
+ [`fields.text.analyzed`]: filter.value
20
+ }
16
21
  }
17
22
  ]
18
23
  }
@@ -85,9 +90,15 @@ module.exports.containsAny = (filter) => {
85
90
  }
86
91
  },
87
92
  {
88
- nested: {
89
- path: 'fields',
90
- query: mapping
93
+ bool: {
94
+ should: [
95
+ {
96
+ nested: {
97
+ path: 'fields',
98
+ query: mapping
99
+ }
100
+ }
101
+ ]
91
102
  }
92
103
  }
93
104
  ]
@@ -43,6 +43,12 @@ module.exports = (query = {}, searchFields = []) => {
43
43
  fields: localFields.map((x) => `${x}^5`)
44
44
  }
45
45
  });
46
+
47
+ should.push({
48
+ match_phrase_prefix: {
49
+ name: parsedQuery
50
+ }
51
+ });
46
52
  }
47
53
  }
48
54
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@outliant/sunrise-utils",
3
3
  "description": "Helper functions for project Sunrise",
4
- "version": "1.0.7",
4
+ "version": "1.0.8",
5
5
  "license": "ISC",
6
6
  "author": "Outliant",
7
7
  "main": "index.js",