FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Plugins and Code Hacks » How to use Search plugin hook
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: How to use Search plugin hook [message #184815 is a reply to message #184767] Wed, 05 February 2014 17:57 Go to previous message
wferguss   Canada
Messages: 11
Registered: December 2013
Karma:
Junior Member
I ended up adding a hook in a different spot, since all I really needed to do was change how the search_cache table is populated:

        /* Remove expired cache entries. */
        q('DELETE FROM {SQL_TABLE_PREFIX}search_cache WHERE expiry<'. (__request_timestamp__ - $GLOBALS['SEARCH_CACHE_EXPIRY']));

        if (!($total = q_singleval('SELECT count(*) FROM {SQL_TABLE_PREFIX}search_cache WHERE srch_query=\''. $qry_lck .'\' AND query_type='. $qt))) {
            if (defined('plugins') && isset($plugin_hooks['UPDATE_SEARCH_CACHE'])) {
                plugin_call_hook('UPDATE_SEARCH_CACHE', array($qry_lck, $tbl, $qt, $wa));
            } else {
                q('INSERT INTO {SQL_TABLE_PREFIX}search_cache (srch_query, query_type, expiry, msg_id, n_match) '.
                  q_limit('SELECT \''. $qry_lck .'\', '. $qt .', '. __request_timestamp__ .', msg_id, count(*) as word_count FROM {SQL_TABLE_PREFIX}search s INNER JOIN {SQL_TABLE_PREFIX}'. $tbl .' i ON i.word_id=s.id WHERE word IN('. $qr .') GROUP BY msg_id ORDER BY word_count DESC',
                          500, 0));
            }
        }


Any chance this could be accepted into the source?
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Proposed code change to add AUTO_LOGIN plugin hook
Next Topic: Proposed fix to ckeditor.plugin
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed May 08 20:00:29 GMT 2024

Total time taken to generate the page: 0.04670 seconds