From 6840140f1fbd74ccb2ccbee2d7aa5793182b93c1 Mon Sep 17 00:00:00 2001 From: Chris Smith <chris.eureka@jalakai.co.uk> Date: Mon, 11 Aug 2008 13:06:56 +0200 Subject: [PATCH] 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 --- inc/fulltext.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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'); -- GitLab