[ https://issues.apache.org/jira/browse/SOLR-2716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13090892#comment-13090892 ]
Simon Willnauer commented on SOLR-2716: --------------------------------------- at a first glance this makes totally sense to me. I just wonder if we should take a Set<Filter> instead of List<Filter> from the beginning and maybe make the member final and use EmptySet() instead of null? Somehow I recall that we had a different issue where the order matters and I recall that there where reasons to keep it like it is but I can't find it right now. Maybe somebody else can find the issue if there is one. > QueryResultKey hashCode() and equals() is dependent on filter order > ------------------------------------------------------------------- > > Key: SOLR-2716 > URL: https://issues.apache.org/jira/browse/SOLR-2716 > Project: Solr > Issue Type: Improvement > Components: search > Affects Versions: 3.3 > Reporter: Neil Prosser > Priority: Minor > Attachments: SOLR-2716.patch > > > The hashCode() and equals() methods of a QueryResultKey are dependent on the > order of the filters meaning that potentially identical result sets are > missed when cached. > Query query = new TermQuery(new Term("field1", "value1")); > Query filter1 = new TermQuery(new Term("field2", "value2")); > Query filter2 = new TermQuery(new Term("field3", "value3")); > List<Query> filters1 = new ArrayList<Query>(); > filters1.add(filter1); > filters1.add(filter2); > List<Query> filters2 = new ArrayList<Query>(); > filters2.add(filter2); > filters2.add(filter1); > QueryResultKey key1 = new QueryResultKey(query, filters1, null, 0); > QueryResultKey key2 = new QueryResultKey(query, filters2, null, 0); > // Both the following assertions fail > assert key1.equals(key2); > assert key1.hashCode() == key2.hashCode(); -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org