Small simplification for LuceneGapFragmenter.isNewFragment
----------------------------------------------------------

                 Key: SOLR-953
                 URL: https://issues.apache.org/jira/browse/SOLR-953
             Project: Solr
          Issue Type: Improvement
          Components: highlighter
    Affects Versions: 1.4
            Reporter: Chris Harris
            Priority: Minor
         Attachments: SOLR-953.patch

This little patch makes the code for LuceneGapFragmenter.isNewFragment(Token) 
slightly more intuitive.

The method currently features the line

{code}
fragOffsetAccum += token.endOffset() - fragOffsetAccum;
{code}

This can be simplified, though, to just

{code}
fragOffsetAccum = token.endOffset();
{code}

Maybe it's just me, but I find the latter expression's intent to be 
sufficiently clearer than the former to warrant committing such a change.

This patch makes this simplification. Also, if you do make this simplification, 
then it doesn't really make sense to think of fragOffsetAccum as an accumulator 
anymore, so in the patch we rename the variable to just fragOffset.

Tests from HighlighterTest.java pass with the patch applied.


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

Reply via email to