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

getOffsetGap should not be called for non-anaylyzed fields

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.0.3
    • None
    • modules/analysis
    • None
    • New

    Description

      from: LUCENE-2235

      Since Lucene 3.0.3, when a PerFieldAnalyzerWrapper is constructed with a null defaultAnalyzer it will NPE when DocInverterPerField calls:

       fieldState.offset += docState.analyzer.getOffsetGap(field);
      

      This block should first check that the field is analyzed, or the javadoc on PerFieldAnalyzerWrapper could mention that a null defaultAnalyzer is disallowed.

      Also, the main reason for checking for isAnalyzed, from Uwe Schindler in LUCENE-2235

      One problem coming from not checking for "analyzed" is this:
      You add a field indexed and it gets analyzed by PFAW - After that you add the same field name stored-only (which is perfectly legal and often used, e.g. when the stored value is binary or in some other format and does not correspond to the indexed text), the positionIncrement is increased. After that you again add another instance of the same field as indexed-only, which also increases posIncr. So you have 2 times the gap between both indexed sub-fields. This is definitely wrong.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              npellow Nick Pellow

              Dates

                Created:
                Updated:

                Slack

                  Issue deployment