Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Can Silverstripe search file


Reply

3 Posts   1231 Views

Avatar
eceers

6 May 2010 at 6:42pm Community Member, 24 Posts

My client has a need to be able to include text from PDF's in site searchs. Does anyone know if this possible using the standard silverstripe search?

I found this page [url]http://doc.silverstripe.org/modules:sphinx[/url] but can't seem to find much more on it.

Any help would be greatly appreciated.

Avatar
Willr

6 May 2010 at 10:32pm Forum Moderator, 5511 Posts

The built in search cannot search pdf text so you'll have to use Sphinx which you can download via svn - http://svn.silverstripe.com/open/modules/sphinx/trunk. A bit more documentation is available in the readme file / docs bundled with the module.

Avatar
swaiba

7 May 2010 at 9:00pm Forum Moderator, 1796 Posts

no, but you do not need any exe's to do so, you can use php functions to get the text content of a pdf (http://www.webcheatsheet.com/php/reading_clean_text_from_pdf.php) and then you can change "function results($data, $form)" in Page.php to add items to the results based on what you find.

foreach ($arrPDFs as $pdf)
{
   $p = new Page();
   $p->Title = "Title"; //update with value from current pdf
   $p->URLSegment = "URLSegment"; //update with value from current pdf
   $p->Content = "Content"; //update with value from current pdf
   $p->Name = "Name"; //update with value from current pdf
   $p->Relevance = 1;//not sure about this one
   $p->CanViewType = 'Anyone';

   $data['Results']->push($p);
}