summaryrefslogtreecommitdiff
path: root/inc/fulltext.php
diff options
context:
space:
mode:
authorChris Smith <chris.eureka@jalakai.co.uk>2008-08-11 13:06:56 +0200
committerChris Smith <chris.eureka@jalakai.co.uk>2008-08-11 13:06:56 +0200
commit6840140f1fbd74ccb2ccbee2d7aa5793182b93c1 (patch)
treeffc6092d511a8cf6966989a13dd8fbb7a544539a /inc/fulltext.php
parent7a0f9a272fc1f885ff3a5bebcbaf88ae0a43823f (diff)
downloadrpg-6840140f1fbd74ccb2ccbee2d7aa5793182b93c1.tar.gz
rpg-6840140f1fbd74ccb2ccbee2d7aa5793182b93c1.tar.bz2
Add SEARCH_QUERY_FULLPAGE & SEARCH_QUERY_PAGELOOKUP events
SEARCH_QUERY_FULLPAGE event wraps around ft_pageSearch() call, the function which handles the search action and feed searching. The event data is the parameters of this function: data['query'] darcs-hash:20080811110656-f07c6-a149de6cd0ebc997541fa6e3f4bc6788d663dbd3.gz
Diffstat (limited to 'inc/fulltext.php')
-rw-r--r--inc/fulltext.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/inc/fulltext.php b/inc/fulltext.php
index 59053cb59..5af0bfc1b 100644
--- a/inc/fulltext.php
+++ b/inc/fulltext.php
@@ -15,8 +15,21 @@
*
* Returns a list of matching documents for the given query
*
+ * refactored into ft_pageSearch(), _ft_pageSearch() and trigger_event()
+ *
*/
function ft_pageSearch($query,&$highlight){
+
+ $data['query'] = $query;
+ $data['highlight'] =& $highlight;
+
+ return trigger_event('SEARCH_QUERY_FULLPAGE', $data, '_ft_pageSearch');
+}
+function _ft_pageSearch(&$data){
+ // split out original parameters
+ $query = $data['query'];
+ $highlight =& $data['highlight'];
+
$q = ft_queryParser($query);
$highlight = array();
@@ -203,9 +216,20 @@ function ft_mediause($id,$max){
* By default it only matches the pagename and ignores the
* namespace. This can be changed with the second parameter
*
+ * refactored into ft_pageLookup(), _ft_pageLookup() and trigger_event()
+ *
* @author Andreas Gohr <andi@splitbrain.org>
*/
function ft_pageLookup($id,$pageonly=true){
+ $data = array('id' => $id, 'pageonly' => $pageonly);
+ return trigger_event('SEARCH_QUERY_PAGELOOKUP',$data,'_ft_pageLookup');
+}
+
+function _ft_pageLookup(&$data){
+ // split out original parameterrs
+ $id = $data['id'];
+ $pageonly = $data['pageonly'];
+
global $conf;
$id = preg_quote($id,'/');
$pages = file($conf['indexdir'].'/page.idx');