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

CharArraySet.contains(char[] text, int off, int len) does not work

    XMLWordPrintableJSON

    Details

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

      Description

      I try to use the CharArraySet for a filter I am writing. I heavily use char-arrays in my code to speed up things. I stumbled upon a bug in CharArraySet while doing that.

      The method public boolean contains(char[] text, int off, int len) seems not to work.

      When I do

      if (set.contains(buffer,offset,length) {
        ...
      }
      

      my code fails.

      But when I do

      if (set.contains(new String(buffer,offset,length)) {
         ...
      }
      

      everything works as expected.

      Both variants should behave the same. I attach a small piece of code to show the problem.

        Attachments

        1. CharArraySetShowBug.java
          0.6 kB
          Thomas Peuss
        2. LUCENE-1163.patch
          3 kB
          Michael McCandless

          Activity

            People

            • Assignee:
              mikemccand Michael McCandless
              Reporter:
              tpeuss Thomas Peuss
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: