Project

General

Profile

« Previous | Next » 

Revision 9424

only consult fields to merge if there was an existing referenced doc

View differences:

metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/annotation/MetacatAnnotatorSubprocessor.java
19 19

  
20 20
public class MetacatAnnotatorSubprocessor extends AnnotatorSubprocessor {
21 21
	
22
    private static Log log = LogFactory.getLog(AnnotatorSubprocessor.class);
22
    private static Log log = LogFactory.getLog(MetacatAnnotatorSubprocessor.class);
23 23
	
24 24
    
25 25
    @Override
......
33 33
            SolrDoc referencedDoc = docs.get(referencedPid);
34 34

  
35 35
            // make sure we have a reference for the document we annotating
36
            boolean referenceExists = true;
36 37
            if (referencedDoc == null) {
37 38
                try {
38 39
                    referencedDoc = ResourceMapSubprocessor.getSolrDoc(referencedPid);
......
41 42
                            + ".  Exception attempting to communicate with solr server.", e);
42 43
                }
43 44

  
45
                
44 46
                if (referencedDoc == null) {
45 47
                    referencedDoc = new SolrDoc();
48
                    referenceExists = false;
46 49
                }
47 50
                docs.put(referencedPid, referencedDoc);
48 51
            }
......
57 60
            Iterator<SolrElementField> annotationIter = annotations.getFieldList().iterator();
58 61
            while (annotationIter.hasNext()) {
59 62
                SolrElementField annotation = annotationIter.next();
60
                if (!this.getFieldsToMerge().contains(annotation.getName())) {
63
                // only skip merge field if there was an existing record
64
                if (referenceExists && !this.getFieldsToMerge().contains(annotation.getName())) {
61 65
                    log.debug("SKIPPING field (not in fieldsToMerge): " + annotation.getName());
62 66
                    continue;
63 67
                }

Also available in: Unified diff