Issue with modules extending the search

Shaney - April 24, 2008 - 10:11
Project:Views Fast Search
Version:5.x-2.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

This bug was found when using search_attachments, but may appear with other modules implementing search_hook.

This is a fix for the old search (_views_fastsearch_query) and not the new search that requires uniqueness (_views_fastsearch_query_unique)

Views_fastsearch assumes that the sid it selects from search_index is a node id. However if the type is not node this may not be true. One example is with the search_attachments module. Here the sid is actually a fid in the files table.

This can cause incorrect results to display. e.g If the fid of a file is the same as a nid, then that node will be returned.

This fix adds a where clause that checks the value of 'type' field is 'node'.

AttachmentSize
views_fastsearch_search_extension_issue.patch460 bytes

#1

Shaney - April 30, 2008 - 15:54

Found a problem with that patch. When searching a quoted string e.g. "lorem ipsum" search_index is not used and this will produce an error.

This will need to check which table to join on.

#2

Shaney - May 1, 2008 - 08:59

OK, code should be

if ($query->tablequeue[0]['table']){
    $query->add_where('('.$query->tablequeue[0]['table'].'.type=\'node\')', array());
  }

Updated patch attached, but it's hand created as my current machine isn't upto date.

AttachmentSize
views_fastsearch_search_extension_issue_2.patch 529 bytes
 
 

Drupal is a registered trademark of Dries Buytaert.