If you use the search operator filetype to find images (example: filetype:jpg) the search results are invisible, as shown in the attached screen shot.

This appears to be happening because images don't have titles. Consequently, when the html is created, the anchor tags are empty:

  <dt class="title">
  <a href="http://www.unb.ca/ME/research/LTMD/Group.JPG"></a>
</dt>

<dd>
    </dd>
<dt class="title">
  <a href="http://campusrec.unbf.ca/facilities/images/Cardio2.JPG"></a>
</dt>
<dd>
    </dd>
<dt class="title">
  <a href="http://www.unbf.ca/athletics/vreds/auc/images/CopyofBA-House2.JPG"></a>
</dt>
<dd>
    </dd>

This is not a problem when you run a search for a type that does have titles (example: filetype:pdf). So the problem is not the filetype operator, and I would assume that any time a search returns images, they are not visible, whether the filetype operator is used or not. I expect nobody's noticed this before because... it's invisible. If your search was returning images, you'd never know unless you looked at the html code.

I am trying to fix this so I can submit a patch, but I haven't figured out yet when the conversion to html is performed. Any hints would be appreciated. Thanks.

CommentFileSizeAuthor
results.jpg18.17 KBvunger
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mpgeek’s picture

The results are obtained in google_appliance_search_view() [via google_appliance_search()], but the results are themed by core search templates with the call to theme('search_results', ...) on line 1100 in google_appliance.module. To answer your hint question, the HTML is actually built by the core search templates and associated preprocess functions.

vunger’s picture

Does that mean that the only way to fix this is in the search_result template?

mpgeek’s picture

The drupal way would be to do a theme override. The long explanation is http://drupal.org/node/173880. The short answer is register search_result.tpl.php in hook_theme, copy the core search template from /modules/search/search-result.tpl.php into your theme directory and go from there. Note that you need to make sure that images are available in the XML result in order to construct HTML around them. The Devel module's dsm() function is helpful in that regard.

mpgeek’s picture

This is also helpful: http://drupal.org/node/341628 if the "Drupal way" is a new concept.

vunger’s picture

Sorry if I was unclear. I didn't mean I'd go into the search_result template in the core module and change it, I meant, fix this by doing an override. Actually, this module already registers search-result.tpl.php, even if the Search module is not activated. So you can just copy it into your theme and make your changes in the copy. But I think the fix should be made in the module rather than every user doing it individually in their theme. I think if google_appliance had its own copy of search-results.tpl.php, that would be enough to override if the Search module was activated, and in the case of it not being activated, this code in google_appliance_theme:

  // If the search.module is disabled, replicate theme_search_result(s).
  $search_module_disabled = !array_key_exists('search', module_list());
  if ($search_module_disabled) {
    $registry += array(
      'search_result' => array(
        'path' => 'modules/search',
        'file' => 'search.pages.inc',
        'arguments' => array('result' => NULL, 'type' => NULL),
        'template' => 'search-result',
      ),
      'search_results' => array(
        'path' => 'modules/search',
        'file' => 'search.pages.inc',
        'arguments' => array('results' => NULL, 'type' => NULL),
        'template' => 'search-results',
      ),
    );
  }

could be changed to point to the new template file instead of the Search module one.

mpgeek’s picture

I would agree. This exact issue (removal of dependence on core search templates), among others, is addressed in the D7 version. I'm not actually doing any work with the d6 version. The D7 version will be posted here soon (waiting to be added as a maintainer).

vunger’s picture

You're only going to maintain D7 then? Is a D6 maintainer still needed? Hmm... how much work does it involve, being a maintainer?

mpgeek’s picture

I offered up a D7 version that I put together for my institution. It's not as complete as the D6 version, but I anticipate adding features as I need them and maintaing it here. I dunno if I would have time to maintain the BOTH versions at this point. I do know that Jacob is/was maintaining it, but mentioned in another post somewhere that he was seeking new/co-maintainers. I haven't yet been added as a maintainer, so I haven't yet been able to share the D7 version. I'd bet if you ask, you could be a maintainer and roll your patches. Not sure how much attention is being paid to this module though, as I've been waiting at least a month to be added.

If I were added I would gladly maintain at least the D7 version. @vunger what about you?

vunger’s picture

I've been thinking about it. As I've made 3 patches, I feel almost like I'm unofficially maintaining it, only without the power to push anything live. I am wondering about the work load; if I become a maintainer I'll have to deal not only with my issues but other people's issues. But I am using this module as part of work anyway. And if I turned out to be a slacker maintainer, it would still be an improvement over what's happening now, right?

What the heck. I will offer my services.

apaderno’s picture

Version: 6.x-2.0-beta1 » 6.x-2.x-dev
Priority: Major » Normal
Issue summary: View changes
Status: Active » Closed (outdated)

I am closing this issue, as it has been created for a release that is now not supported.