/** * Equality test based attributes values * * @param value * Value to compare */ public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof Contains)) { return false; } final Contains contains = (Contains) other; if ((element == null && contains.getElement() != null) || (element != null && !element.equals(contains.getElement()))) return false; if ((value == null && contains.getValue() != null) || (value != null && !value.equals(contains.getValue()))) return false; return true; }
private String contains2solr(Contains contains) throws WikittyException { if (contains.getElement() == null) { throw new WikittyException("contains.element must not be null"); } if (contains.getValue() == null) { throw new WikittyException("contains.values must not be null"); } if (contains.getValue().size() < 1) { throw new WikittyException("CONTAINS is an operator that handle 1 operand at least"); } String operand = ""; StringBuilder result = new StringBuilder(); result.append(element2solr(contains.getElement())).append(':'); result.append('('); for (String value : contains.getValue()) { result.append(operand); result.append(value2solr(value)); operand = " AND "; } result.append(')'); return result.toString(); }
private String contains2solr(Contains contains) throws WikittyException { if (contains.getElement() == null) { throw new WikittyException("contains.element must not be null"); } if (contains.getValue() == null) { throw new WikittyException("contains.values must not be null"); } if (contains.getValue().size() < 1) { throw new WikittyException("CONTAINS is an operator that handle 1 operand at least"); } String operand = ""; StringBuilder result = new StringBuilder(); result.append(element2solr(contains.getElement())).append(':'); result.append('('); for (String value : contains.getValue()) { result.append(operand); result.append(value2solr(value)); operand = " AND "; } result.append(')'); return result.toString(); }
List<String> values = contains.getValue();