I want to using solr for search on articles
I have 3 table:
My Solution was something as below:
$client = new SolrClient($options);
$query = new SolrQuery();
// Find old Document
$query->setQuery('id:5458');
$query->setStart(0);
$query->setRows(1);
$query_response = $client->query($query);
// I had to set the parsemode to PARSE_SOLR_DOC
$query_response->setParseMode(SolrQueryResponse::PARSE_SOLR_DOC);
$response = $query_response->getResponse();
$doc = new SolrInputDocument();
// used the getInputDocument() to get the old document from the query
$doc = $response->response->docs[0]->getInputDocument();
if ($response->response->numFound) {
$second_doc = new SolrInputDocument();
$second_doc->addField('cat', "category123");
// Notice I removed the second parameter from the merge()
$second_doc->merge($doc);
$updateResponse = $client->addDocument($second_doc);
$client->commit();
}