1--TEST-- 2SolrInputDocument::updateField 3--FILE-- 4<?php 5 6require_once 'bootstrap.inc'; 7 8$doc = new SolrInputDocument(); 9 10$doc->addField('id', 1123); 11 12$doc->updateField('field1', SolrInputDocument::UPDATE_MODIFIER_ADD, 'val1'); 13$doc->updateField('field2_s', SolrInputDocument::UPDATE_MODIFIER_SET, 'val2'); 14$doc->updateField('field3_i', SolrInputDocument::UPDATE_MODIFIER_INC, 5); 15$doc->updateField('field1', SolrInputDocument::UPDATE_MODIFIER_REMOVE, 'val0'); 16$doc->updateField('field1', SolrInputDocument::UPDATE_MODIFIER_REMOVEREGEX, '[\d]{2}/[\d]{2}/[\d]{4}'); 17 18try { 19 $doc->updateField('arr2', 6, 'not gonna happen'); 20} catch (SolrIllegalArgumentException $e) { 21 print_exception($e); 22} 23 24try { 25 $doc->updateField('arr3', 0, 'not gonna happen'); 26} catch (SolrIllegalArgumentException $e) { 27 print_exception($e); 28} 29 30print_r($doc->toArray()); 31 32?> 33--EXPECT-- 34SolrIllegalArgumentException 4003: Invalid field value modifier. 35SolrIllegalArgumentException 4003: Invalid field value modifier. 36Array 37( 38 [document_boost] => 0 39 [field_count] => 4 40 [fields] => Array 41 ( 42 [0] => SolrDocumentField Object 43 ( 44 [name] => id 45 [boost] => 0 46 [values] => Array 47 ( 48 [0] => 1123 49 ) 50 51 ) 52 53 [1] => SolrDocumentField Object 54 ( 55 [name] => field1 56 [boost] => 0 57 [values] => Array 58 ( 59 [0] => val1 60 [1] => val0 61 [2] => [\d]{2}/[\d]{2}/[\d]{4} 62 ) 63 64 ) 65 66 [2] => SolrDocumentField Object 67 ( 68 [name] => field2_s 69 [boost] => 0 70 [values] => Array 71 ( 72 [0] => val2 73 ) 74 75 ) 76 77 [3] => SolrDocumentField Object 78 ( 79 [name] => field3_i 80 [boost] => 0 81 [values] => Array 82 ( 83 [0] => 5 84 ) 85 86 ) 87 88 ) 89 90) 91