@usereactify/search 5.56.1 → 5.56.2

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
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [5.56.2](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.56.1...release-v5.56.2) (2025-01-01)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * improve suggestions to include more results when searching ([ba04d45](https://bitbucket.org/usereactify/reactify-search-ui/commit/ba04d45a9fb649ac371bbcfc1003f83cf47aee6d))
11
+
5
12
  ### [5.56.1](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.56.0...release-v5.56.1) (2024-12-20)
6
13
 
7
14
 
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@usereactify/search",
3
3
  "description": "React UI library for Reactify Search",
4
- "version": "5.56.1",
4
+ "version": "5.56.2",
5
5
  "license": "MIT",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",
@@ -18,10 +18,15 @@ const Suggestions = (props) => {
18
18
  suggest: {
19
19
  suggestions: {
20
20
  text: searchTerm,
21
- term: {
21
+ phrase: {
22
22
  field: props.field,
23
- sort: "score",
24
- suggest_mode: "always",
23
+ gram_size: 2,
24
+ confidence: 0,
25
+ direct_generator: [{
26
+ field: props.field,
27
+ suggest_mode: "always",
28
+ min_word_length: 1,
29
+ }],
25
30
  },
26
31
  },
27
32
  },
@@ -35,7 +40,10 @@ const Suggestions = (props) => {
35
40
  };
36
41
  if ((_b = (_a = renderProps.rawData) === null || _a === void 0 ? void 0 : _a.suggest) === null || _b === void 0 ? void 0 : _b.suggestions.length) {
37
42
  const options = (_c = renderProps.rawData.suggest.suggestions[renderProps.rawData.suggest.suggestions.length - 1]) === null || _c === void 0 ? void 0 : _c.options;
38
- props.suggestions = options.filter((option) => { var _a; return !((_a = reactifySearchContext.config.suggestions.exclude) !== null && _a !== void 0 ? _a : []).includes(option.text); }).map((option) => ({
43
+ props.suggestions = options
44
+ .filter((option) => option.text !== searchTerm)
45
+ .filter((option) => { var _a; return !((_a = reactifySearchContext.config.suggestions.exclude) !== null && _a !== void 0 ? _a : []).includes(option.text); })
46
+ .map((option) => ({
39
47
  text: option.text,
40
48
  }));
41
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Suggestions.js","sourceRoot":"","sources":["../../../../src/components/Suggestions/Suggestions.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,iDAI0B;AAC1B,uCAAkE;AAa3D,MAAM,WAAW,GAA+B,CAAC,KAAK,EAAE,EAAE;;IAC/D,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,+BAAkB,CAAC;IAE3D,MAAM,qBAAqB,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAEzD,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,iBAAS,GAAE,CAAC;IAEnC,MAAM,SAAS,GAAG,IAAA,uBAAU,EAAC,qBAAqB,CAAC,OAAO,CAAC,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAE/F,OAAO,CACL,8BAAC,4BAAe,IACd,WAAW,EAAC,mBAAmB,EAC/B,YAAY,EAAE,GAAG,EAAE;YACjB,OAAO;gBACL,OAAO,EAAE;oBACP,WAAW,EAAE;wBACX,IAAI,EAAE,UAAU;wBAChB,IAAI,EAAE;4BACJ,KAAK,EAAE,KAAK,CAAC,KAAK;4BAClB,IAAI,EAAE,OAAO;4BACb,YAAY,EAAE,QAAQ;yBACvB;qBACF;iBACF;aACF,CAAC;QACJ,CAAC,EACD,KAAK,EAAE;YACL,GAAG,EAAE,SAAS;SACf,EACD,MAAM,EAAE,CAAC,WAAW,EAAE,EAAE;;YACtB,MAAM,KAAK,GAEP;gBACF,WAAW,EAAE,EAAE;aAChB,CAAC;YAEF,IAAI,MAAA,MAAA,WAAW,CAAC,OAAO,0CAAE,OAAO,0CAAE,WAAW,CAAC,MAAM,EAAE,CAAC;gBACrD,MAAM,OAAO,GAAG,MAAA,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,0CAAE,OAAO,CAAC;gBACrH,KAAK,CAAC,WAAW,GAAI,OAAiD,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,WAAC,OAAA,CAAC,CAAC,MAAA,qBAAqB,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,mCAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA,EAAA,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;oBAC1L,IAAI,EAAE,MAAM,CAAC,IAAI;iBAClB,CAAC,CAAC,CAAC;YACN,CAAC;YAED,OAAO,8BAAC,eAAe,oBAAK,KAAK,EAAI,CAAC;QACxC,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AA/CW,QAAA,WAAW,eA+CtB","sourcesContent":["import React from \"react\";\n\nimport {\n CustomComponent,\n ExampleSuggestions,\n SENSOR_IDS,\n} from \"../../components\";\nimport { useReactifySearchContext, useSearch } from \"../../hooks\";\n\nexport type SuggestionsProps = {\n /** The field which should be used for autocompletion */\n field: \"title\";\n /** Render method */\n render?: React.FC<{\n suggestions: Array<{\n text: string;\n }>;\n }>;\n};\n\nexport const Suggestions: React.FC<SuggestionsProps> = (props) => {\n const RenderComponent = props.render ?? ExampleSuggestions;\n\n const reactifySearchContext = useReactifySearchContext();\n\n const { searchTerm } = useSearch();\n\n const sensorIds = SENSOR_IDS(reactifySearchContext.options.mode, reactifySearchContext.config);\n\n return (\n <CustomComponent\n componentId=\"SensorSuggestions\"\n defaultQuery={() => {\n return {\n suggest: {\n suggestions: {\n text: searchTerm,\n term: {\n field: props.field,\n sort: \"score\",\n suggest_mode: \"always\",\n },\n },\n },\n };\n }}\n react={{\n and: sensorIds,\n }}\n render={(renderProps) => {\n const props: React.ComponentProps<\n NonNullable<SuggestionsProps[\"render\"]>\n > = {\n suggestions: [],\n };\n\n if (renderProps.rawData?.suggest?.suggestions.length) {\n const options = renderProps.rawData.suggest.suggestions[renderProps.rawData.suggest.suggestions.length - 1]?.options;\n props.suggestions = (options as Array<{ text: string; freq: number }>).filter((option) => !(reactifySearchContext.config.suggestions.exclude ?? []).includes(option.text)).map((option) => ({\n text: option.text,\n }));\n }\n\n return <RenderComponent {...props} />;\n }}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"Suggestions.js","sourceRoot":"","sources":["../../../../src/components/Suggestions/Suggestions.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,iDAI0B;AAC1B,uCAAkE;AAa3D,MAAM,WAAW,GAA+B,CAAC,KAAK,EAAE,EAAE;;IAC/D,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,+BAAkB,CAAC;IAE3D,MAAM,qBAAqB,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAEzD,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,iBAAS,GAAE,CAAC;IAEnC,MAAM,SAAS,GAAG,IAAA,uBAAU,EAAC,qBAAqB,CAAC,OAAO,CAAC,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAE/F,OAAO,CACL,8BAAC,4BAAe,IACd,WAAW,EAAC,mBAAmB,EAC/B,YAAY,EAAE,GAAG,EAAE;YACjB,OAAO;gBACL,OAAO,EAAE;oBACP,WAAW,EAAE;wBACX,IAAI,EAAE,UAAU;wBAChB,MAAM,EAAE;4BACN,KAAK,EAAE,KAAK,CAAC,KAAK;4BAClB,SAAS,EAAE,CAAC;4BACZ,UAAU,EAAE,CAAC;4BACb,gBAAgB,EAAE,CAAC;oCACjB,KAAK,EAAE,KAAK,CAAC,KAAK;oCAClB,YAAY,EAAE,QAAQ;oCACtB,eAAe,EAAE,CAAC;iCACnB,CAAC;yBACH;qBACF;iBACF;aACF,CAAC;QACJ,CAAC,EACD,KAAK,EAAE;YACL,GAAG,EAAE,SAAS;SACf,EACD,MAAM,EAAE,CAAC,WAAW,EAAE,EAAE;;YACtB,MAAM,KAAK,GAEP;gBACF,WAAW,EAAE,EAAE;aAChB,CAAC;YAEF,IAAI,MAAA,MAAA,WAAW,CAAC,OAAO,0CAAE,OAAO,0CAAE,WAAW,CAAC,MAAM,EAAE,CAAC;gBACrD,MAAM,OAAO,GAAG,MAAA,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,0CAAE,OAAO,CAAC;gBACrH,KAAK,CAAC,WAAW,GAAI,OAAiD;qBACnE,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC;qBAC9C,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,WAAC,OAAA,CAAC,CAAC,MAAA,qBAAqB,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,mCAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA,EAAA,CAAC;qBACnG,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;oBAChB,IAAI,EAAE,MAAM,CAAC,IAAI;iBAClB,CAAC,CAAC,CAAC;YACR,CAAC;YAED,OAAO,8BAAC,eAAe,oBAAK,KAAK,EAAI,CAAC;QACxC,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAvDW,QAAA,WAAW,eAuDtB","sourcesContent":["import React from \"react\";\n\nimport {\n CustomComponent,\n ExampleSuggestions,\n SENSOR_IDS,\n} from \"../../components\";\nimport { useReactifySearchContext, useSearch } from \"../../hooks\";\n\nexport type SuggestionsProps = {\n /** The field which should be used for autocompletion */\n field: \"title\";\n /** Render method */\n render?: React.FC<{\n suggestions: Array<{\n text: string;\n }>;\n }>;\n};\n\nexport const Suggestions: React.FC<SuggestionsProps> = (props) => {\n const RenderComponent = props.render ?? ExampleSuggestions;\n\n const reactifySearchContext = useReactifySearchContext();\n\n const { searchTerm } = useSearch();\n\n const sensorIds = SENSOR_IDS(reactifySearchContext.options.mode, reactifySearchContext.config);\n\n return (\n <CustomComponent\n componentId=\"SensorSuggestions\"\n defaultQuery={() => {\n return {\n suggest: {\n suggestions: {\n text: searchTerm,\n phrase: {\n field: props.field,\n gram_size: 2,\n confidence: 0,\n direct_generator: [{\n field: props.field,\n suggest_mode: \"always\",\n min_word_length: 1,\n }],\n },\n },\n },\n };\n }}\n react={{\n and: sensorIds,\n }}\n render={(renderProps) => {\n const props: React.ComponentProps<\n NonNullable<SuggestionsProps[\"render\"]>\n > = {\n suggestions: [],\n };\n\n if (renderProps.rawData?.suggest?.suggestions.length) {\n const options = renderProps.rawData.suggest.suggestions[renderProps.rawData.suggest.suggestions.length - 1]?.options;\n props.suggestions = (options as Array<{ text: string; freq: number }>)\n .filter((option) => option.text !== searchTerm)\n .filter((option) => !(reactifySearchContext.config.suggestions.exclude ?? []).includes(option.text))\n .map((option) => ({\n text: option.text,\n }));\n }\n\n return <RenderComponent {...props} />;\n }}\n />\n );\n};\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@usereactify/search",
3
3
  "description": "React UI library for Reactify Search",
4
- "version": "5.56.1",
4
+ "version": "5.56.2",
5
5
  "license": "MIT",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",