Adding multiple values ​​to phr Solr

How can I add multiple values ​​to a multi-value field using the php solr extension?

+4
source share
2 answers

You just iterate over the array (multiValued),
and run addField once for each array value.

foreach (array('Justin', 'Sean') as $coder) { $doc->addField('coder', $coder); } 
+8
source

Firstly:

Add a multi-valued field to your solr instance and restart it.

Secondly:

 <?php $multi_values = array("val-1", "val-2", "val-3"); foreach ($multi_values as $i => $value) { $SolrInputDocument->addField("field_name", $value, $i); } 

His job!

view php docs here

+2
source

All Articles