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

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

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3
    • 2.4
    • None
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: