Lucene - Core
  1. Lucene - Core
  2. LUCENE-6093

BlendedInfixSuggester throws NullPointerException if there were discarded trailing characters in the query

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 4.10.2
    • Fix Version/s: 4.10.4, 5.0, 5.1, 6.0
    • Component/s: modules/spellchecker
    • Labels:
      None
    • Environment:

      Any environment

    • Lucene Fields:
      New

      Description

      BlendedInfixSuggester throws NullPointerException if there were discarded trailing characters (e.g. whitespace or special character) in the query.

      The problem seems to be in the createCoefficient method that fails to check if prefixToken parameter is null. AnalyzingInfixSuggester sets prefixToken to null in the described case and passes it to BlendedInfixSuggester. On the side not even if BlendedInfixSuggester is changed to handle this creates a problem to calculate the weights as prefixToken is null and cannot be used. I would be better to have AnalyzingInfixSuggester to always set prefixToken to lastToken.

        Activity

        Hide
        jane chang added a comment -

        here's a patch, fix plus test, to handle null prefix tokens, eg when there is a trailing space, there is no prefix token

        Show
        jane chang added a comment - here's a patch, fix plus test, to handle null prefix tokens, eg when there is a trailing space, there is no prefix token
        Hide
        Michael McCandless added a comment -

        Thanks jane, patch looks good. I'll just add javadocs advertising that prefix token can be null and commit ...

        Show
        Michael McCandless added a comment - Thanks jane, patch looks good. I'll just add javadocs advertising that prefix token can be null and commit ...
        Hide
        ASF subversion and git services added a comment -

        Commit 1656173 from Michael McCandless in branch 'dev/trunk'
        [ https://svn.apache.org/r1656173 ]

        LUCENE-6093: don't throw NPE when BlendedInfixSuggester.lookup doesn't have a prefix token

        Show
        ASF subversion and git services added a comment - Commit 1656173 from Michael McCandless in branch 'dev/trunk' [ https://svn.apache.org/r1656173 ] LUCENE-6093 : don't throw NPE when BlendedInfixSuggester.lookup doesn't have a prefix token
        Hide
        ASF subversion and git services added a comment -

        Commit 1656174 from Michael McCandless in branch 'dev/branches/branch_5x'
        [ https://svn.apache.org/r1656174 ]

        LUCENE-6093: don't throw NPE when BlendedInfixSuggester.lookup doesn't have a prefix token

        Show
        ASF subversion and git services added a comment - Commit 1656174 from Michael McCandless in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1656174 ] LUCENE-6093 : don't throw NPE when BlendedInfixSuggester.lookup doesn't have a prefix token
        Hide
        ASF subversion and git services added a comment -

        Commit 1656175 from Michael McCandless in branch 'dev/branches/lucene_solr_5_0'
        [ https://svn.apache.org/r1656175 ]

        LUCENE-6093: don't throw NPE when BlendedInfixSuggester.lookup doesn't have a prefix token

        Show
        ASF subversion and git services added a comment - Commit 1656175 from Michael McCandless in branch 'dev/branches/lucene_solr_5_0' [ https://svn.apache.org/r1656175 ] LUCENE-6093 : don't throw NPE when BlendedInfixSuggester.lookup doesn't have a prefix token
        Hide
        Michael McCandless added a comment -

        Thanks jane!

        Show
        Michael McCandless added a comment - Thanks jane!
        Hide
        Jan Høydahl added a comment -

        I'll backport this to 4.10 branch

        Show
        Jan Høydahl added a comment - I'll backport this to 4.10 branch
        Hide
        ASF subversion and git services added a comment -

        Commit 1660727 from janhoy@apache.org in branch 'dev/branches/lucene_solr_4_10'
        [ https://svn.apache.org/r1660727 ]

        LUCENE-6093: BlendedInfixSuggester throws NullPointerException if there were discarded trailing characters in the query (backport)

        Show
        ASF subversion and git services added a comment - Commit 1660727 from janhoy@apache.org in branch 'dev/branches/lucene_solr_4_10' [ https://svn.apache.org/r1660727 ] LUCENE-6093 : BlendedInfixSuggester throws NullPointerException if there were discarded trailing characters in the query (backport)
        Hide
        Anshum Gupta added a comment -

        Bulk close after 5.0 release.

        Show
        Anshum Gupta added a comment - Bulk close after 5.0 release.

          People

          • Assignee:
            Jan Høydahl
            Reporter:
            Andrei Filimonov
          • Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development