[dokuwiki] Re: Index attachements with external search engine


----- Original Message -----
From: "Shiva Shankar" <shivshan@xxxxxxxxxxx>

>I have to decide on a Wiki for my organization, and one requirement is that
>the search should also include attachement contents.

If you want to modify DokuWiki search results, what I do is add a search 
event notification to DokuWiki to allow plugins to intervene (before and/or 
after):

In fulltext.php, I rename the original "ft_pageSearch" function to 
"ft_defaultpageSearch" , then add:

function ft_pageSearch($query,&$poswords){
    // give plugins an opportunity to process the search
    $docs=array();
    $params = array();
    $params['query'] = &$query;
    $params['poswords'] = &$poswords;
    $params['docs'] = &$docs;
    $evt = new Doku_Event('SEARCH_RESULT',$params);
    if ($evt->advise_before()) {
        $docs=ft_defaultpageSearch($query,$poswords);
    }  // end event SEARCH_RESULT default action
    $evt->advise_after();
    unset($evt);
    return $docs;
}

Then you can write a plugin to do whatever kind of searching you require. Of 
course you'd be "on your own" with attachment searches, without benefit from 
DokuWiki's great indexing. If your goal is to add keywords from attached 
documents, you'd want to handle the INDEXER_PAGE_ADD event as well.

P.S. I'd love to have this SEARCH_RESULT event added to core code. Any 
interest?

Todd Augsburger
todd@xxxxxxxxxxxxxxxx
Roller Organs
www.rollerorgans.com
 

-- 
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: