SimpleSortField extends SortField { @Override public int hashCode() { int result = field.hashCode(); result = 31 * result + (reverse ? 1 : 0); return result; } SimpleSortField(String field, Boolean reverse); String getField(); @Override org.apache.lucene.search.SortField sortField(Schema schema); Set<String> postProcessingFields(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); final String field; }
@Test public void testHashCode() { assertEquals("SortField equals is wrong", -1274708409, new SimpleSortField("field", true).hashCode()); assertEquals("SortField equals is wrong", -1274708410, new SimpleSortField("field", false).hashCode()); }