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

MultiPhraseQuery has incorrect hashCode() implementation - Leads to Solr Cache misses

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: None
    • Component/s: core/search
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      I found this while hunting for the cause of Solr Cache misses.

      The MultiPhraseQuery class hashCode() implementation is non-deterministic. It uses termArrays.hashCode() in the computation. The contents of that ArrayList are actually arrays themselves, which return there reference ID as a hashCode instead of returning a hashCode which is based on the contents of the array. I would suggest an implementation involving the Arrays.hashCode() method.

      I will try to submit a patch soon, off for today.

        Attachments

        1. MultiPhraseQueryTest.java
          0.9 kB
          Todd Feak
        2. MultiPhraseQuery.java
          11 kB
          Todd Feak
        3. LUCENE-1415.patch
          3 kB
          Mark Miller
        4. LUCENE-1415.patch
          3 kB
          Mark Miller

          Issue Links

            Activity

              People

              • Assignee:
                yseeley@gmail.com Yonik Seeley
                Reporter:
                tfeak Todd Feak
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: