cosmocode / docsearch

Search through uploaded documents in DokuWiki
http://www.dokuwiki.org/plugin:docsearch
11 stars 11 forks source link

Request: open PDF with search terms highlighted #7

Open holmbergius opened 14 years ago

holmbergius commented 14 years ago

Can the plugin open PDF results with search terms highlighted? This should be simply a matter of passing the search results into the link for the PDF URL. The format is documented here:

http://partners.adobe.com/public/developer/en/acrobat/PDFOpenParameters.pdf

Thanks! Jason

holmbergius commented 14 years ago

This code snippet does it. Can I contribute it?

    foreach ($data as $id => $hits) {
        $pos = strpos($id,".pdf");

        if($pos === false) {
            echo '<a href="'.ml($id).'" title="" class="wikilink1">'.hsc($id).'</a>:';
        }
        else {
            $pdfstring="ml($id)"+"?search="+$QUERY;
            echo '<a href="'.ml($id).'#search='.$QUERY.'" title="" class="wikilink1">'.hsc($id).'</a>:';
        }
holmbergius commented 14 years ago

That's in action.php.