You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Adrian Nistor (JIRA)" <ji...@apache.org> on 2013/06/29 23:47:20 UTC
[jira] [Updated] (SOLR-4979) Wasted work in
DocumentAnalysisRequestHandler.readDocument
[ https://issues.apache.org/jira/browse/SOLR-4979?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Adrian Nistor updated SOLR-4979:
--------------------------------
Attachment: patchShort.diff
patch.diff
> Wasted work in DocumentAnalysisRequestHandler.readDocument
> ----------------------------------------------------------
>
> Key: SOLR-4979
> URL: https://issues.apache.org/jira/browse/SOLR-4979
> Project: Solr
> Issue Type: Bug
> Affects Versions: 4.3.1
> Environment: any
> Reporter: Adrian Nistor
> Priority: Minor
> Labels: patch, performance
> Attachments: patch.diff, patchShort.diff
>
>
> The problem appears in version 4.3.1 and in revision 1498027. I
> attached a two-line patch (patch.diff) that fixes it.
> In method "DocumentAnalysisRequestHandler.readDocument", the loop over
> "reader.getAttributeLocalName" keeps overriding "fieldName" with
> "reader.getAttributeValue(i)". Therefore, only the last written value
> is visible out of the loop and all the other writes and iterations are
> not necessary. The patch iterates from the end of
> "reader.getAttributeLocalName" and breaks the first time when
> "fieldName" is set.
> The above fix (in patch.diff) is certainly correct (it's easy to see
> through code inspection), but I think we can have an even shorter
> patch (one line, in patchShort.diff): just break as soon as
> "fieldName" is set, without reversion the loop order. patchShort.diff
> is correct only if there can be only one "attrName" equal to "name"
> (which I think it's the case), or if it doesn't matter which attribute
> value "fieldName" gets, as long as the condition
> "name".equals(attrName) is satisfied.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org