lanners
User
 Fresh Boarder
| Posts: 3 |   | Karma: 0
|
Re:Search Only PDFs box - 2010/06/04 17:38
From what I've read it sounds like Nate is a busy father (Congrats btw).
Anyways, I too was looking for a search only PDF solution. I edited Nate's code to add and PDF search only box.
I don't make any promises about the code but it's a fairly simplistic change. You'll only need a basic text editor.
1. Locate and open the pdfs.searchbot.php file located and (siterootpluginssearch)
2. Locate $_MAMBOTS->registerFunction( 'onSearch', 'botSearchIndexedPDFs' ); (should be around line 26. Add the following lines of code.
$_MAMBOTS->registerFunction( 'onSearchAreas', 'plgSearchPDFsAreas' );
/** * @return array An array of search areas */ function &plgSearchPDFsAreas() { static $areas = array( 'pdfs' => 'PDFs' ); return $areas; }
3. locate function botSearchIndexedPDFs and add ", $areas=null" to the arguments. So the resulting function should look like this:
function botSearchIndexedPDFs( $text, $phrase='', $ordering='', $areas=null ) {
4. under the $key1.. and $key2.. declarations add the following code segment.
if (is_array( $areas )) { if (!array_intersect( $areas, array_keys( plgSearchPDFsAreas() ) )) { return array(); } }
5. You're done, save and refresh.
|