Lucene - Core
  1. Lucene - Core
  2. LUCENE-1481

Sort and SortField does not have equals() and hashCode()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 2.9
    • Component/s: core/query/scoring
    • Labels:
      None
    • Lucene Fields:
      New, Patch Available

      Description

      During developing for my project panFMP I had the following issue:
      I have a cache for queries (like Solr has, too) for query results. This cache also uses the Sort/SortField as key into the cache. The problem is, because Sort/SortField does not implement equals() and hashCode(), you cannot store them as cache keys. To workaround, currently I use Sort.toString() as cache key, but this is not so nice.

      In corelation with issue LUCENE-1478, I could fix this there in one patch together with the other improvements.

      1. LUCENE-1481.patch
        2 kB
        Uwe Schindler

        Issue Links

          Activity

          Uwe Schindler created issue -
          Uwe Schindler made changes -
          Field Original Value New Value
          Link This issue is part of LUCENE-1478 [ LUCENE-1478 ]
          Michael McCandless made changes -
          Assignee Michael McCandless [ mikemccand ]
          Hide
          Michael McCandless added a comment -

          This sounds reasonable. Probably we could do a separate patch, here, and resolve this first?

          Show
          Michael McCandless added a comment - This sounds reasonable. Probably we could do a separate patch, here, and resolve this first?
          Hide
          Uwe Schindler added a comment -

          No problem, I check out a new svn trunk copy and do the changes here. They do not affect my other changes. This is rather simple (only again, that Arrays.hashCode() appears only first in Java 1.5 , see LUCENE-1415).

          And juhee, this is now my fifth or sixth patch for a Lucene project (TIKA and LUCENE together), I think I am ready to apply for Apache Contributor status , currently I am only contributor and maintainer of a module in PHP core (which is a Apache related project, but a little bit special).

          As a side-note to the discussion about the serialization issues and the contributer status discussion on java-dev...

          Show
          Uwe Schindler added a comment - No problem, I check out a new svn trunk copy and do the changes here. They do not affect my other changes. This is rather simple (only again, that Arrays.hashCode() appears only first in Java 1.5 , see LUCENE-1415 ). And juhee, this is now my fifth or sixth patch for a Lucene project (TIKA and LUCENE together), I think I am ready to apply for Apache Contributor status , currently I am only contributor and maintainer of a module in PHP core (which is a Apache related project, but a little bit special). As a side-note to the discussion about the serialization issues and the contributer status discussion on java-dev...
          Hide
          Uwe Schindler added a comment -

          Attached the patch that extends Sort and SortField by a hashCode and equals

          Show
          Uwe Schindler added a comment - Attached the patch that extends Sort and SortField by a hashCode and equals
          Uwe Schindler made changes -
          Attachment LUCENE-1481.patch [ 12395505 ]
          Uwe Schindler made changes -
          Link This issue blocks LUCENE-1478 [ LUCENE-1478 ]
          Hide
          Uwe Schindler added a comment -

          The patch of LUCENE-1478 must be modified to extend the new hashCode()/equals() to supply equals and hashCode also for the new "parser" member.

          Show
          Uwe Schindler added a comment - The patch of LUCENE-1478 must be modified to extend the new hashCode()/equals() to supply equals and hashCode also for the new "parser" member.
          Uwe Schindler made changes -
          Lucene Fields [New] [New, Patch Available]
          Uwe Schindler made changes -
          Link This issue is part of LUCENE-1478 [ LUCENE-1478 ]
          Hide
          Michael McCandless added a comment -

          Patch looks good; I'll commit shortly.

          Show
          Michael McCandless added a comment - Patch looks good; I'll commit shortly.
          Hide
          Michael McCandless added a comment -

          Committed revision 724379.

          Thanks Uwe!

          Show
          Michael McCandless added a comment - Committed revision 724379. Thanks Uwe!
          Michael McCandless made changes -
          Fix Version/s 2.9 [ 12312682 ]
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Lucene Fields [Patch Available, New] [New, Patch Available]
          Mark Miller made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Mark Thomas made changes -
          Workflow jira [ 12447932 ] Default workflow, editable Closed status [ 12562834 ]
          Mark Thomas made changes -
          Workflow Default workflow, editable Closed status [ 12562834 ] jira [ 12583741 ]

            People

            • Assignee:
              Michael McCandless
              Reporter:
              Uwe Schindler
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development