@kodaris/krubble-app-components 1.0.75 → 1.0.76

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.
@@ -6121,15 +6121,26 @@
6121
6121
  this._skillRequestId++;
6122
6122
  const requestId = this._skillRequestId;
6123
6123
  const trimmed = query.trim();
6124
- // multi_match with an empty string matches nothing, so an empty query falls
6125
- // back to match_all to show everything.
6124
+ // An empty query matches everything; otherwise substring-match the query
6125
+ // against name/code/description. We use case-insensitive wildcard queries on
6126
+ // the `.raw` keyword subfields so "ord" matches anywhere in "Create Order"
6127
+ // (a plain match/multi_match only matches whole tokens). Escape the wildcard
6128
+ // specials so user input is treated literally, then wrap with `*...*`.
6126
6129
  let must = { match_all: {} };
6127
6130
  if (trimmed) {
6131
+ const pattern = `*${trimmed.replace(/([*?\\])/g, '\\$1')}*`;
6132
+ const value = {
6133
+ value: pattern,
6134
+ case_insensitive: true,
6135
+ };
6128
6136
  must = {
6129
- multi_match: {
6130
- query: trimmed,
6131
- fields: ['name^3', 'description^2', 'instructions'],
6132
- type: 'best_fields',
6137
+ bool: {
6138
+ should: [
6139
+ { wildcard: { 'name.raw': value } },
6140
+ { wildcard: { 'code.raw': value } },
6141
+ { wildcard: { 'description.raw': value } },
6142
+ ],
6143
+ minimum_should_match: 1,
6133
6144
  },
6134
6145
  };
6135
6146
  }