==== Wikka Mod 029 ==== Type: Feature Addition ---- ===Credit:=== **[[PolVazo | pmyatt]]** -- for the original idea and function code. ---- Use MySQL "UNION" to search for text in TAG as well as the full text search that often returns no results. This will search for **partial** matches in page titles (tags). This is of great benefit because the regular search would not find a search for the word "camel" even if you had a page named "CamelCase". This modified search will now find that page. Here is the function I added in **wakka.php**: %%(code) function FullTextSearchAndLikeTags($phrase) { return $this->LoadAll(" (select * from ".$this->config["table_prefix"] ."pages where latest = 'Y' and tag like('%".mysql_escape_string($phrase) ."%')) UNION (select * from ".$this->config["table_prefix"] ."pages where latest = 'Y' and match(tag, body) against('".mysql_escape_string($phrase)."'))"); } %% Then I modified **actions/textsearch.php** and **actions/textsearchexpanded.php** to use the new function. ---- **Alternative way to do it** This is the way I did it with MySQL v4 as the above only works with MySQL v3. In wikka.php change the function FullTextSearch from: %% { $data = $this->LoadAll("select * from " .$this->config["table_prefix"] ."pages where latest = 'Y' and match(tag, body) against('".mysql_real_escape_string($phrase) ."' IN BOOLEAN MODE) order by time DESC"); } %% To: %% { $data = $this->LoadAll(" select * from " .$this->config["table_prefix"] ."pages where latest = 'Y' and tag like('%".mysql_escape_string($phrase)."%') UNION select * from " .$this->config["table_prefix"] ."pages where latest = 'Y' and match(tag, body) against('".mysql_real_escape_string($phrase) ."' IN BOOLEAN MODE) order by time DESC"); } %% --pmyatt To to this in v1.3.1 In /libs/Wakka.class.php Replace: %%(php) $sql = 'select * from '.$this->config['table_prefix'].'pages'; $sql .= ' where latest = '. "'Y'" .' and match(tag, body'.$id.')'; $sql .= ' against('. "'$search_phrase'" .' IN BOOLEAN MODE)'; $sql .= ' order by time DESC'; %% with %%(php) $sql = 'select * from '.$this->config['table_prefix'].'pages'; $sql .= ' where latest = '. "'Y'" . " and tag like('%" . mysql_escape_string($search_phrase) . "%') UNION select * from "; $sql .= $this->config['table_prefix'] . 'pages where latest = '. "'Y'" .' and match(tag, body'.$id.')'; $sql .= ' against('. "'$search_phrase'" .' IN BOOLEAN MODE)'; $sql .= ' order by time DESC'; %% ''Great, thanks. This will be added to version 1.1.5.4.'' -- JsnX