- Issue created by @Menthos
- 🇩🇪Germany mkalkbrenner 🇩🇪
"Sarnia" has been merged into this module. You get full access to all fields in views using the "Solr Document Datasource".
- 🇨🇦Canada Menthos
So i found the solr document data in the $view array, now I am trying to figure out how to alter my view. When I alter the view, its not getting updated.
I can get all the values of the source solr document, with all the fields.
I can manipulate the values in the $view object in _hook_views_post_execute in $view->result[0]->_item
The changes are not reflected in the actual data displayed.Anyone has any idea if there is a hook I can work with from that? Maybe the hook i am using is too late, i.e. the views fields are already populated from the item element, so even if i make changes there, they are not reflected?
Code snippet:function osgg_search_api_extras_views_post_execute($view){ $view_fields_values=&$view->result[0]; $view_fields_definition=$view->result[0]->_item->getFields(); $solr_original_document=$view->result[0]->_item->getOriginalObject(); $original_fields=$solr_original_document->getValue()->getFields(); foreach($view_fields_definition as $key=>$value){ if($key=="i18n_citation_en"){ //replace with french value $field=$view->result[0]->_item->getField($key); $field->setValues($original_fields["i18n_citation_fr"]->getValues()); } } }
- Status changed to Fixed
over 1 year ago 9:57am 16 June 2023 - 🇩🇪Germany mkalkbrenner 🇩🇪
It might be easier to create a new feature for the Solr Document Datasource. Feel free to provide a patch.
Automatically closed - issue fixed for 2 weeks with no activity.