Project

General

Profile

« Previous | Next » 

Revision 8761

only allow multiple values for multi-valued fields....

View differences:

metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/SolrIndex.java
391 391
	    	SolrDoc doc = new SolrDoc();
392 392
	    	
393 393
	    	// include existing values if they exist
394
	        IndexSchema indexSchema = SolrQueryServiceController.getInstance().getSchema();
395

  
394 396
	        if (res.getResults().size() > 0) {
395 397
		        SolrDocument orig = res.getResults().get(0);
396
		        IndexSchema indexSchema = SolrQueryServiceController.getInstance().getSchema();
397 398
		    	for (String fieldName: orig.getFieldNames()) {
398 399
		        	//  don't transfer the copyTo fields, otherwise there are errors
399 400
		        	if (indexSchema.isCopyFieldTarget(indexSchema.getField(fieldName))) {
......
419 420
	    		List<Object> values = fields.get(fieldName);
420 421
	    		for (Object value: values) {
421 422
	    			if (!doc.hasFieldWithValue(fieldName, value.toString())) {
422
		    			doc.addField(new SolrElementField(fieldName, value.toString()));
423
	    				if (indexSchema.getField(fieldName).multiValued()) {
424
	    					doc.addField(new SolrElementField(fieldName, value.toString()));
425
	    				} else {
426
	    	    	    	doc.updateOrAddField(fieldName, value.toString());
427
	    				}
423 428
	    			}
424
	    	    	//doc.updateOrAddField(fieldName, value.toString());
425 429
	    		}
426 430
	    	}
427 431
	        

Also available in: Unified diff