I wanted to access the keyword being searched in the Apache Solr. Thus i used the hook_apachesolr_process_results Hook to access the $query variable.

But I am unable to access the keyword as it is inside a SolrBaseQuery [params:protected] object.

It throws a error saying Fatal error: Cannot access protected property SolrBaseQuery::$params

Is there any way of accessing the protected parameters of Apache Solr or is there any other approach to get the keyword being searched.

1 Answer 1


It's always a good idea to read through the code for a class you're trying to work with.

For example, a quick look through the code yields SolrBaseQuery::getParams(), whose responsibility is to ensure accuracy for, and return, the protected $params array.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.