You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "Chris Harris (JIRA)" <ji...@apache.org> on 2009/01/12 20:26:00 UTC
[jira] Created: (SOLR-953) Small simplification for
LuceneGapFragmenter.isNewFragment
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.
[jira] Resolved: (SOLR-953) Small simplification for
LuceneGapFragmenter.isNewFragment
Posted by "Otis Gospodnetic (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SOLR-953?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Otis Gospodnetic resolved SOLR-953.
-----------------------------------
Resolution: Fixed
Assignee: Otis Gospodnetic
Thanks Chris.
Sending src/java/org/apache/solr/highlight/GapFragmenter.java
Transmitting file data .
Committed revision 734336.
> 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
> Assignee: Otis Gospodnetic
> 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.
[jira] Updated: (SOLR-953) Small simplification for
LuceneGapFragmenter.isNewFragment
Posted by "Chris Harris (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SOLR-953?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Chris Harris updated SOLR-953:
------------------------------
Attachment: SOLR-953.patch
> 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.