Lucene - Core
  1. Lucene - Core
  2. LUCENE-4959

Incorrect return value from SimpleNaiveBayesClassifier.assignClass

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.2.1, 6.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Lucene Fields:
      New

      Description

      The local copy of BytesRef referenced by foundClass is affected by subsequent TermsEnum.iterator.next() calls as the shared BytesRef.bytes changes.

      If a term "test" gives a good match and a next term in the terms collection is "classification" with a lower match score then the return result will be "clas"

        Activity

        Hide
        Alexey Kutin added a comment -

        Replaced BytesRef.clone() with BytesRef.deepCopyOf() to let it hold on to the instance while iterating.

        Also had to change unit tests to expose the issue first.

        Show
        Alexey Kutin added a comment - Replaced BytesRef.clone() with BytesRef.deepCopyOf() to let it hold on to the instance while iterating. Also had to change unit tests to expose the issue first.
        Hide
        Commit Tag Bot added a comment -

        [trunk commit] jpountz
        http://svn.apache.org/viewvc?view=revision&revision=1476650

        LUCENE-4959: Fix incorrect return value in SimpleNaiveBayesClassifier.assignClass.

        Show
        Commit Tag Bot added a comment - [trunk commit] jpountz http://svn.apache.org/viewvc?view=revision&revision=1476650 LUCENE-4959 : Fix incorrect return value in SimpleNaiveBayesClassifier.assignClass.
        Hide
        Commit Tag Bot added a comment -

        [branch_4x commit] jpountz
        http://svn.apache.org/viewvc?view=revision&revision=1476651

        LUCENE-4959: Fix incorrect return value in SimpleNaiveBayesClassifier.assignClass.

        Show
        Commit Tag Bot added a comment - [branch_4x commit] jpountz http://svn.apache.org/viewvc?view=revision&revision=1476651 LUCENE-4959 : Fix incorrect return value in SimpleNaiveBayesClassifier.assignClass.
        Hide
        Adrien Grand added a comment -

        Thanks Alexey!

        Show
        Adrien Grand added a comment - Thanks Alexey!
        Hide
        Tommaso Teofili added a comment -

        thanks Alexey for reporting and fixing and Adrien for taking care of it, I was offline and could notice it just now

        Show
        Tommaso Teofili added a comment - thanks Alexey for reporting and fixing and Adrien for taking care of it, I was offline and could notice it just now

          People

          • Assignee:
            Adrien Grand
            Reporter:
            Alexey Kutin
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development