[ https://issues.apache.org/jira/browse/LUCENE-2146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12790069#action_12790069 ]
Uwe Schindler commented on LUCENE-2146: --------------------------------------- And the patch is against 2.9 without generics. It should be a patch against trunk. The method is like this in trunk: {code} /** Add a collection of disjuncts to this disjunction * via Iterable<Query> */ public void add(Collection<Query> disjuncts) { this.disjuncts.addAll(disjuncts); } {code} And why does the patch change the behaviour or fixes the bug? addAll() does the same like the while-loop. > DisjunctionMaxQuery has incorrect hashCode() implementation > ------------------------------------------------------------ > > Key: LUCENE-2146 > URL: https://issues.apache.org/jira/browse/LUCENE-2146 > Project: Lucene - Java > Issue Type: Bug > Components: Search > Affects Versions: 2.9 > Reporter: wang > Priority: Minor > Fix For: 3.1 > > Attachments: DisjunctionMaxQueryTest.java, LUCENE-2146.patch > > > The DisjunctionMaxQuery class hashCode() implementation is non-deterministic. > It uses disjuncts.hashCode() in the computation. > if the contents of disjuncts are arrays, just as DisjunctionMaxQueryTest. > ArrayList > list1 = new ArrayList(); > ArrayList list2 = new ArrayList(); > String[] terms ={"term1","term2"}; > String[] terms2 ={"term1","term2"}; > list1.add(terms); > list2.add(terms2); > DisjunctionMaxQuery query1 = new > DisjunctionMaxQuery(list1,0.0f); > DisjunctionMaxQuery query2 = new > DisjunctionMaxQuery(list2,0.0f); > according to the definition of DisjunctionMaxQuery, i think query1 and query2 > should be equal. > but DisjunctionMaxQueryTest failed. That is because of > DisjunctionMaxQuery.hashCode(){disjuncts.hasCode()}; > maybe my thought is wrong. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org For additional commands, e-mail: java-dev-h...@lucene.apache.org