How to use wildcard search in apache solr search module?

I am working on apachesolr search module. I want to implement wildcard search i have used hook_apachesolr_query_prepare() function to modify apachesolr query but it is not working can any one give me solution. I have implemented code like this. I have taken reference from here : https://www.drupal.org/project/apachesolr/issues/1539284

function custommodule_apachesolr_query_prepare(DrupalSolrQueryInterface &$  query, &$  caller) {    $  search = '';   $  keywords = preg_split("/[\s,]+/", $  query->getParam('q'));     foreach ($  keywords as $  keyword) {     $  search .= '*' . strtolower($  keyword) . '* ';       }    $  query->addParam('defType', 'edismax');     $  query->replaceParam('q', $  search);    }