These changes apply to the JOOMLA_ROOT/plugins/search/phocagallery.php file. Line numbers and file references are based on the original phocagallery.php search plugin file from the plg_search_phocagallery_v2.6.0 package.
You must insert a case statement to generate unique WHERE clause contents based on the radio button selection (@ line 44, snippet includes the preceding and following statements for reference):
Code: Select all
if ($text == '') {
return array();
}
$wheres = array();
switch ($phrase) {
case 'exact':
$text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false );
$wheres2 = array();
$wheres2[] = 'a.title LIKE '.$text;
$wheres2[] = 'a.description LIKE '.$text;
$where = '(' . implode( ') OR (', $wheres2 ) . ')';
break;
case 'all':
case 'any':
default:
$words = explode( ' ', $text );
$wheres = array();
foreach ($words as $word) {
$word = $db->Quote( '%'.$db->getEscaped( $word, true ).'%', false );
$wheres2 = array();
$wheres2[] = 'a.title LIKE '.$word;
$wheres2[] = 'a.description LIKE '.$word;
$wheres[] = implode( ' OR ', $wheres2 );
}
$where = '(' . implode( ($phrase == 'all' ? ') AND (' : ') OR ('), $wheres ) . ')';
break;
}
$section = JText::_( 'Phoca Gallery');
Now you must update the WHERE clause in both SQL queries so that the initial parenthetical is the string generated in the above code.
Change the original (@ lines 75-77):
Code: Select all
. ' WHERE ( a.title LIKE '.$text
. ' OR a.name LIKE '.$text
. ' OR a.description LIKE '.$text.' )'
Code: Select all
. ' WHERE ( '.$where.' )'
Code: Select all
. ' WHERE ( a.title LIKE '.$text
. ' OR a.filename LIKE '.$text
. ' OR a.description LIKE '.$text.' )'
Code: Select all
. ' WHERE ( '.$where.' )'