[ 
https://issues.apache.org/jira/browse/NUTCH-1638?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13763546#comment-13763546
 ] 

Sebastian Nagel commented on NUTCH-1638:
----------------------------------------

Hi [~ascheffe], a trial to reproduce the problem with current trunk didn't 
succeed.
Adding log messages to SolrIndexWriter:
{code:java}
String sCopy = solrMapping.mapCopyKey(e.getKey());
LOG.info("copyField: " + e.getKey() + " -> " + sCopy
    + " (" + (sCopy != e.getKey()) + ")");
if (sCopy != e.getKey()) {
    inputDoc.addField(sCopy, val);
    LOG.info("adding copyField " + sCopy);
}
{code}
and running {{bin/nutch solrindex}} gets:
{noformat}
...
solr.SolrMappingReader - source: url dest: id
solr.SolrMappingReader - source: url dest: url
solr.SolrIndexWriter - copyField: host -> host (false)
...
solr.SolrIndexWriter - copyField: lang -> lang (false)
solr.SolrIndexWriter - copyField: url -> url (true)
solr.SolrIndexWriter - adding copyField url
solr.SolrIndexWriter - copyField: anchor -> anchor (false)
...
{noformat}
According to logs, {{inputDoc.addField(sCopy, val2);}} is executed only for 
field "url". That's correct because "url" is copied by default 
{{solrindex-mapping.xml}}.

Could you
* report exact Nutch and Java versions?
* attach {{solrindex-mapping.xml}} (if modified)?
* show a short log snippet which indicates which fields are erroneously copied.

This would help to get the problem reproduced. Thanks.

                
> SolrWriter Bad String comparision
> ---------------------------------
>
>                 Key: NUTCH-1638
>                 URL: https://issues.apache.org/jira/browse/NUTCH-1638
>             Project: Nutch
>          Issue Type: Bug
>          Components: indexer
>    Affects Versions: 1.7, 2.2.1
>            Reporter: Aaron Scheffel
>            Priority: Minor
>              Labels: patch
>         Attachments: NUTCH-1638.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> In version 2.2.1 and 1.7
> Class org.apache.nutch.indexer.solr.SolrWriter
> Line 66
> inputDoc.addField(solrMapping.mapKey(e.getKey()), val2);
> String sCopy = solrMapping.mapCopyKey(e.getKey());
> if (sCopy != e.getKey()) {
> inputDoc.addField(sCopy, val2);
> }
> There is a string comparison "sCopy != e.getKey()" with a != and not an
> equals. It basically never works right. Not sure if someone was trying to
> be clever but even if those strings are the same they happen to be
> different objects. Which I'm assuming is due to how the strings are
> serialized in from the config files.
> Suggest its updated to
> String sCopy = solrMapping.mapCopyKey(e.getKey());
> if (!sCopy.equals(solrMapping.mapKey(e.getKey()))) {
>        inputDoc.addField(sCopy, val2);
> }
> -Aaron

--
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

Reply via email to