getOffsetGap should not be called for non-anaylyzed fields
----------------------------------------------------------

                 Key: LUCENE-2801
                 URL: https://issues.apache.org/jira/browse/LUCENE-2801
             Project: Lucene - Java
          Issue Type: Bug
          Components: Analysis
    Affects Versions: 3.0.3
            Reporter: Nick Pellow


from: LUCENE-2235

Since Lucene 3.0.3, when a PerFieldAnalyzerWrapper is constructed with a null 
defaultAnalyzer it will NPE when DocInverterPerField calls:
{code}
 fieldState.offset += docState.analyzer.getOffsetGap(field);
{code}
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
{quote}
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.

{quote}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to