SEARCH-419: Correct handling of fieldfacet label and exclusion filters

This commit is contained in:
Gethin James
2017-03-09 16:08:58 +01:00
parent 36e738b423
commit 23b2c9f047

View File

@@ -1289,6 +1289,8 @@ public class SearchParameters implements BasicSearchParameters
public static class FieldFacet public static class FieldFacet
{ {
String field; String field;
String label;
List<String> excludeFilters;
String prefix = null; String prefix = null;
FieldFacetSort sort = null; FieldFacetSort sort = null;
Integer limitOrNull = null; Integer limitOrNull = null;
@@ -1411,70 +1413,78 @@ public class SearchParameters implements BasicSearchParameters
this.enumMethodCacheMinDF = enumMethodCacheMinDF; this.enumMethodCacheMinDF = enumMethodCacheMinDF;
} }
@Override public String getLabel()
public int hashCode()
{ {
final int prime = 31; return label;
int result = 1; }
result = prime * result + (countDocsMissingFacetField ? 1231 : 1237);
result = prime * result + enumMethodCacheMinDF; public void setLabel(String label)
result = prime * result + ((field == null) ? 0 : field.hashCode()); {
result = prime * result + ((limitOrNull == null) ? 0 : limitOrNull.hashCode()); this.label = label;
result = prime * result + ((method == null) ? 0 : method.hashCode()); }
result = prime * result + minCount;
result = prime * result + offset; public List<String> getExcludeFilters()
result = prime * result + ((prefix == null) ? 0 : prefix.hashCode()); {
result = prime * result + ((sort == null) ? 0 : sort.hashCode()); return excludeFilters;
return result; }
public void setExcludeFilters(List<String> excludeFilters)
{
this.excludeFilters = excludeFilters;
} }
@Override @Override
public boolean equals(Object obj) public boolean equals(Object o)
{ {
if (this == obj) if (this == o)
return true; return true;
if (obj == null) if (o == null || getClass() != o.getClass())
return false; return false;
if (getClass() != obj.getClass())
FieldFacet that = (FieldFacet) o;
if (offset != that.offset)
return false; return false;
FieldFacet other = (FieldFacet) obj; if (minCount != that.minCount)
if (countDocsMissingFacetField != other.countDocsMissingFacetField)
return false; return false;
if (enumMethodCacheMinDF != other.enumMethodCacheMinDF) if (countDocsMissingFacetField != that.countDocsMissingFacetField)
return false; return false;
if (field == null) if (enumMethodCacheMinDF != that.enumMethodCacheMinDF)
{
if (other.field != null)
return false;
}
else if (!field.equals(other.field))
return false; return false;
if (limitOrNull == null) if (!field.equals(that.field))
{
if (other.limitOrNull != null)
return false;
}
else if (!limitOrNull.equals(other.limitOrNull))
return false; return false;
if (method != other.method) if (label != null ? !label.equals(that.label) : that.label != null)
return false; return false;
if (minCount != other.minCount) if (excludeFilters != null ? !excludeFilters.equals(that.excludeFilters) : that.excludeFilters != null)
return false; return false;
if (offset != other.offset) if (prefix != null ? !prefix.equals(that.prefix) : that.prefix != null)
return false; return false;
if (prefix == null) if (sort != that.sort)
{
if (other.prefix != null)
return false;
}
else if (!prefix.equals(other.prefix))
return false; return false;
if (sort != other.sort) if (limitOrNull != null ? !limitOrNull.equals(that.limitOrNull) : that.limitOrNull != null)
return false; return false;
if (method != that.method)
return false;
return true; return true;
} }
@Override
public int hashCode()
{
int result = field.hashCode();
result = 31 * result + (label != null ? label.hashCode() : 0);
result = 31 * result + (excludeFilters != null ? excludeFilters.hashCode() : 0);
result = 31 * result + (prefix != null ? prefix.hashCode() : 0);
result = 31 * result + (sort != null ? sort.hashCode() : 0);
result = 31 * result + (limitOrNull != null ? limitOrNull.hashCode() : 0);
result = 31 * result + offset;
result = 31 * result + minCount;
result = 31 * result + (countDocsMissingFacetField ? 1 : 0);
result = 31 * result + (method != null ? method.hashCode() : 0);
result = 31 * result + enumMethodCacheMinDF;
return result;
}
} }
/** /**