Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-2146

DisjunctionMaxQuery has incorrect hashCode() implementation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Invalid
    • 2.9
    • None
    • core/search
    • None
    • New, Patch Available

    Description

      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.

      Attachments

        1. LUCENE-2146.patch
          0.5 kB
          wang
        2. DisjunctionMaxQueryTest.java
          0.9 kB
          wang

        Activity

          People

            Unassigned Unassigned
            wdq2001_0001@163.com wang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: