@Test public void transformToEqualsCriteria_SINGLE_OR() { String actual = criterionTransformer.transformToEqualsCriteria(JudgmentIndexField.JUDGMENT_TYPE, Lists.newArrayList(JudgmentType.DECISION.name()), Operator.OR); assertEquals("+judgmentType:DECISION", actual); }
public String transformToEqualsCriteria(F field, List<String> values, Operator operator) { List<String> notEmptyValues = values.stream().filter(x -> StringUtils.isNotBlank(x)).collect(Collectors.toList()); if (notEmptyValues.isEmpty()) { return StringUtils.EMPTY; } List<String> singleValueCriterionList = Lists.newLinkedList(); notEmptyValues.stream() .map(x -> buildEqualsCriterion(field.getFieldName(), x, operator)) .forEach(singleValueCriterionList::add); if (singleValueCriterionList.size() == 1 && operator == Operator.OR) { return "+" + singleValueCriterionList.get(0); } String multivaluedCriterion = singleValueCriterionList.stream().collect(Collectors.joining(" ")); return (operator == Operator.OR) ? ("+(" + multivaluedCriterion + ")") : multivaluedCriterion; }
SolrCriterionTransformer { public String transformToEqualsCriteria(F field, List<String> values, Operator operator) { List<String> notEmptyValues = values.stream().filter(x -> StringUtils.isNotBlank(x)).collect(Collectors.toList()); if (notEmptyValues.isEmpty()) { return StringUtils.EMPTY; } List<String> singleValueCriterionList = Lists.newLinkedList(); notEmptyValues.stream() .map(x -> buildEqualsCriterion(field.getFieldName(), x, operator)) .forEach(singleValueCriterionList::add); if (singleValueCriterionList.size() == 1 && operator == Operator.OR) { return "+" + singleValueCriterionList.get(0); } String multivaluedCriterion = singleValueCriterionList.stream().collect(Collectors.joining(" ")); return (operator == Operator.OR) ? ("+(" + multivaluedCriterion + ")") : multivaluedCriterion; } }
SolrCriterionTransformer { public String transformToEqualsCriteria(F field, List<String> values, Operator operator) { List<String> notEmptyValues = values.stream().filter(x -> StringUtils.isNotBlank(x)).collect(Collectors.toList()); if (notEmptyValues.isEmpty()) { return StringUtils.EMPTY; } List<String> singleValueCriterionList = Lists.newLinkedList(); notEmptyValues.stream() .map(x -> buildEqualsCriterion(field.getFieldName(), x, operator)) .forEach(singleValueCriterionList::add); if (singleValueCriterionList.size() == 1 && operator == Operator.OR) { return "+" + singleValueCriterionList.get(0); } String multivaluedCriterion = singleValueCriterionList.stream().collect(Collectors.joining(" ")); return (operator == Operator.OR) ? ("+(" + multivaluedCriterion + ")") : multivaluedCriterion; }  }
SolrCriterionTransformer { public String transformToEqualsCriteria(F field, List<String> values, Operator operator) { List<String> notEmptyValues = values.stream().filter(x -> StringUtils.isNotBlank(x)).collect(Collectors.toList()); if (notEmptyValues.isEmpty()) { return StringUtils.EMPTY; } List<String> singleValueCriterionList = Lists.newLinkedList(); notEmptyValues.stream() .map(x -> buildEqualsCriterion(field.getFieldName(), x, operator)) .forEach(singleValueCriterionList::add); if (singleValueCriterionList.size() == 1 && operator == Operator.OR) { return "+" + singleValueCriterionList.get(0); } String multivaluedCriterion = singleValueCriterionList.stream().collect(Collectors.joining(" ")); return (operator == Operator.OR) ? ("+(" + multivaluedCriterion + ")") : multivaluedCriterion; }  String transformToEqualsCriterionWithParsing(F field, String value); String transformToEqualsCriterion(F field, String value); String transformToEqualsCriterion(F field, String value, Operator operator); String transformToEqualsCriterion(F field, Integer value); String transformToEqualsCriterion(F field, Long value); String transformToEqualsCriterion(F field, Enum<?> enumValue); String transformToEqualsCriteria(F field, List<String> values, Operator operator); String transformToEqualsEnumCriteria(F field, List<? extends Enum<?>> values, Operator operator); String transformToDateRangeCriterion(F field, LocalDate from, LocalDate to); String transformToRangeCriterion(F field, String from, String to); String and(String criterion); String join(List<String> criteria); }
SolrCriterionTransformer { public String transformToEqualsCriteria(F field, List<String> values, Operator operator) { List<String> notEmptyValues = values.stream().filter(x -> StringUtils.isNotBlank(x)).collect(Collectors.toList()); if (notEmptyValues.isEmpty()) { return StringUtils.EMPTY; } List<String> singleValueCriterionList = Lists.newLinkedList(); notEmptyValues.stream() .map(x -> buildEqualsCriterion(field.getFieldName(), x, operator)) .forEach(singleValueCriterionList::add); if (singleValueCriterionList.size() == 1 && operator == Operator.OR) { return "+" + singleValueCriterionList.get(0); } String multivaluedCriterion = singleValueCriterionList.stream().collect(Collectors.joining(" ")); return (operator == Operator.OR) ? ("+(" + multivaluedCriterion + ")") : multivaluedCriterion; }  String transformToEqualsCriterionWithParsing(F field, String value); String transformToEqualsCriterion(F field, String value); String transformToEqualsCriterion(F field, String value, Operator operator); String transformToEqualsCriterion(F field, Integer value); String transformToEqualsCriterion(F field, Long value); String transformToEqualsCriterion(F field, Enum<?> enumValue); String transformToEqualsCriteria(F field, List<String> values, Operator operator); String transformToEqualsEnumCriteria(F field, List<? extends Enum<?>> values, Operator operator); String transformToDateRangeCriterion(F field, LocalDate from, LocalDate to); String transformToRangeCriterion(F field, String from, String to); String and(String criterion); String join(List<String> criteria);  }