@zengenti/contensis-react-base 3.0.0-beta.29 → 3.0.0-beta.32

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/cjs/search.js CHANGED
@@ -882,7 +882,7 @@ const fieldExpression = (field, value, operator = 'equalTo', weight) => {
882
882
  // to generate expressions that are combined with an 'or' operator
883
883
  return [contensisCoreApi.Op.or(...field.map(fieldId => fieldExpression(fieldId, value, operator, weight)).flat())];
884
884
  if (operator === 'between') return between(field, value);
885
- if (Array.isArray(value)) return equalToOrIn(field, value, operator);else return !weight ? [contensisCoreApi.Op[operator](field, value, undefined, undefined)] : [contensisCoreApi.Op[operator](field, value, undefined, undefined).weight(weight)];
885
+ if (Array.isArray(value)) return equalToOrIn(field, value, operator);else return !weight ? equalToOrIn(field, value, operator) : [equalToOrIn(field, value, operator)[0].weight(weight)];
886
886
  };
887
887
  const contentTypeIdExpression = (contentTypeIds, webpageTemplates, assetTypes) => {
888
888
  const expressions = [];
@@ -1008,12 +1008,24 @@ const equalToOrIn = (field, value, operator = 'equalTo') => {
1008
1008
  }))];
1009
1009
  }
1010
1010
 
1011
- return [];
1011
+ switch (operator) {
1012
+ case 'between':
1013
+ case 'distanceWithin':
1014
+ // Not implemented
1015
+ return [contensisCoreApi.Op.equalTo(field, value)];
1016
+
1017
+ case 'freeText':
1018
+ // TODO: Potentially needs further implementation of new options
1019
+ return [contensisCoreApi.Op[operator](field, value, false, undefined)];
1020
+
1021
+ default:
1022
+ return [contensisCoreApi.Op[operator](field, value)];
1023
+ }
1012
1024
  };
1013
1025
 
1014
1026
  const between = (field, value) => {
1015
1027
  const handle = betweenValue => {
1016
- const valArr = betweenValue.split('-');
1028
+ const valArr = betweenValue.split('--');
1017
1029
 
1018
1030
  if (valArr.length > 1) {
1019
1031
  const [minimum, maximum] = betweenValue.split('-');
@@ -2263,7 +2275,7 @@ var reducers = (config => {
2263
2275
  case APPLY_CONFIG:
2264
2276
  {
2265
2277
  state = addConfigToState(state, action);
2266
- return;
2278
+ return state;
2267
2279
  }
2268
2280
 
2269
2281
  case CLEAR_FILTERS: