lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neil Prosser (JIRA)" <>
Subject [jira] [Created] (SOLR-2716) QueryResultKey hashCode() and equals() is dependent on filter order
Date Wed, 17 Aug 2011 23:04:27 GMT
QueryResultKey hashCode() and equals() is dependent on filter order

                 Key: SOLR-2716
             Project: Solr
          Issue Type: Improvement
          Components: search
    Affects Versions: 3.3
            Reporter: Neil Prosser
            Priority: Minor

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>();

List<Query> filters2 = new ArrayList<Query>();

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:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message