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

          Hide
          Michael McCandless added a comment -

          Committed revision 724379.

          Thanks Uwe!

          Show
          Michael McCandless added a comment - Committed revision 724379. Thanks Uwe!
          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
          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.
          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
          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
          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?

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development