Full report available here: http://pareview.sh/pareview/httpgitdrupalorgprojectsearchapigit-7x-1x

I wasn't sure what to do with the undefined $key in SearchApiViewsCache::get_results_key(), so I switched it to $key_data['exposed_info'] = $_GET['exposed_info'];. Also a typo in variable name is a slight performance change in SearchApiHighlight::getFulltextFields().

Normally I just provide 1 patch, but due to the volume of code in this module, I'll try and keep all the whitespace/style fixes separate.

Comments

drunken monkey’s picture

Thanks a lot for reporting these! I've also found a few more, those are included, too, in the attached revised patch.
Also, there are some unused function parameters – do we want to remove those, too? They are attached in a separate patch. (I didn't remove unused $form_state parameters for form functions, though, to make things (hopefully) clearer.)

Further comments (also fixed in the first attached patch):

  1. +++ b/contrib/search_api_facetapi/plugins/facetapi/adapter.inc
    @@ -139,7 +139,7 @@ class SearchApiFacetapiAdapter extends FacetapiAdapter {
    -        list($query, $results) = $search;
    +        list($query, ) = $search;
    

    I think this can just be list($query).

  2. +++ b/includes/processor_highlight.inc
    @@ -167,7 +167,7 @@ class SearchApiHighlight extends SearchApiAbstractProcessor {
         // Act as if $load is TRUE if we have a loaded item.
    -    $load |= !empty($result['entity']);
    +    $load |= !empty($results['entity']);
     
         $result = &$results[$i];
    

    OK, this is not only a style problem, but a bug in the code itself. The correct fix, however, is to move the statement a line down, after $result is initialized.

In any case, thanks again for posting this! I'm always happy to improve the code quality of my modules – sadly, a lot of cruft has accumulated over the years (especially in the doc comments, due to evolving standards).

drunken monkey’s picture

Status: Needs review » Fixed

Committed.
Thanks again for your patch!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.