Project

General

Profile

« Previous | Next » 

Revision 9982

Added by Jing Tao over 7 years ago

Add more log information.

View differences:

metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/SolrIndex.java
193 193
    private Map<String, SolrDoc> process(String id, SystemMetadata systemMetadata, String objectPath)
194 194
                    throws IOException, SAXException, ParserConfigurationException,
195 195
                    XPathExpressionException, MarshallingException, EncoderException, SolrServerException, NotImplemented, NotFound, UnsupportedType{
196

  
196
        log.debug("SolrIndex.process - trying to generate the solr doc object for the pid "+id);
197 197
        // Load the System Metadata document
198 198
        ByteArrayOutputStream systemMetadataOutputStream = new ByteArrayOutputStream();
199 199
        TypeMarshaller.marshalTypeToOutputStream(systemMetadata, systemMetadataOutputStream);
......
212 212
        
213 213
        // get the format id for this object
214 214
        String formatId = indexDocument.getFirstFieldValue(SolrElementField.FIELD_OBJECTFORMAT);
215

  
215
        log.debug("SolrIndex.process - the object format id for the pid "+id+" is "+formatId);
216 216
        // Determine if subprocessors are available for this ID
217 217
        if (subprocessors != null) {
218 218
	        // for each subprocessor loaded from the spring config
......
228 228
	                    // referenced by the resource map.
229 229
	                	FileInputStream dataStream = new FileInputStream(objectPath);
230 230
	                    if (!dataStream.getFD().valid()) {
231
	                    	log.error("Could not load OBJECT file for ID,Path=" + id + ", "
231
	                    	log.error("SolrIndex.process - subprocessor "+ subprocessor.getClass().getName() +" couldn't process since it could not load OBJECT file for ID,Path=" + id + ", "
232 232
                                    + objectPath);
233 233
	                        //throw new Exception("Could not load OBJECT for ID " + id );
234 234
	                    } else {
235 235
	                        docs = subprocessor.processDocument(id, docs, dataStream);
236
	                        log.debug("SolrIndex.process - subprocessor "+ subprocessor.getClass().getName() +" generated solr doc for id "+id);
236 237
	                    }
237 238
	                } catch (Exception e) {
238 239
	                    e.printStackTrace();
......
381 382
                    throws IOException, SAXException, ParserConfigurationException,
382 383
                    XPathExpressionException, SolrServerException, MarshallingException, EncoderException, NotImplemented, NotFound, UnsupportedType {
383 384
        checkParams(pid, systemMetadata, objectPath);
385
        log.debug("SolrIndex.insert - trying to insert the solrDoc for object "+pid.getValue());
384 386
        Map<String, SolrDoc> docs = process(pid.getValue(), systemMetadata, objectPath);
385 387
        
386 388
        //transform the Map to the SolrInputDocument which can be used by the solr server
......
390 392
                if(id != null) {
391 393
                    SolrDoc doc = docs.get(id);
392 394
                    insertToIndex(doc);
395
                    log.debug("SolrIndex.insert - inserted the solr-doc object of pid "+id+", which relates to object "+pid.getValue()+", into the solr server.");
393 396
                }
394 397
                
395 398
            }
399
            log.debug("SolrIndex.insert - finished to insert the solrDoc for object "+pid.getValue());
400
        } else {
401
            log.debug("SolrIndex.insert - the genered solrDoc is null. So we will not index the object "+pid.getValue());
396 402
        }
397 403
    }
398 404
    
......
479 485
                    if(field != null) {
480 486
                        String value = field.getValue();
481 487
                        String name = field.getName();
482
                        //System.out.println("add name/value pair - "+name+"/"+value);
488
                        log.trace("SolrIndex.insertToIndex - add name/value pair - "+name+"/"+value);
483 489
                        solrDoc.addField(name, value);
484 490
                    }
485 491
                }
......
537 543
            log.error("SolrIndex.update - the systemMetadata or pid is null. So nothing will be indexed.");
538 544
            return;
539 545
        }
546
        log.debug("SolrIndex.update - trying to update(insert or remove) solr index of object "+pid.getValue());
540 547
        String objectPath = null;
541 548
        try {
542 549
            if (systemMetadata.getArchived() == null || !systemMetadata.getArchived()) {

Also available in: Unified diff