Forum

JiFile for Joomla!

JIFile
JiFile is a component for Joomla! that allows you to index file contents (PDF, DOC, etc..) to perform searches in them.

Learn more...  Demo

JoomPhoto Mobile

JPhotoMobile
JoomPhoto Mobile is a component for Joomla! that allows you to share the photos from your Android device to your site Joomla.

Learn more...  Demo

iFile Framework

IFile
IFile is an open source framework written entirely in PHP, allows the indexing of textual content of a document (DOC, PDF, EXCEL, etc.) and a quick search within them.

Learn more...  Demo

Easy Language

EasyLanguage
Easy Language is a plugin for easy and immediate management of multilingual texts in every possible area of joomla, articles, components, modules, metadata, template, other components(example K2) etc.

Learn more...

Article Book Effect

Article Book Effect
View Joomla articles with the effect turns the page of a book. This plugin will display the contents of an article in Joomla as a real book or magazine, using all the benefits of HTML5

Learn more...  Demo

 

Passport photo

Passport photo
The most popular Android app that allows you to print photos cards for your documents with your Android smartphone, in a simple and intuitive way.

Learn more...

 

Crazy Shadow

Crazy Shadow
Crazy Shadow is the 3D fast-paced and fun puzzle Android game! Try to rotate and drag shapes in the position of their shadows without fail! Solve in succession all combinations of levels of the game.

Learn more...

 

Admin Countdown

Admin Countdown
Module for Joomla! 2.5 and 3.x displays in the administration part of the site, a timer with countdown of the time remaining in your session.

Learn more...  Demo

 
Welcome, Guest
Username: Password: Remember me

TOPIC: IFile and "highlight" ( like Google Search )

IFile and "highlight" ( like Google Search ) 08 May 2012 18:26 #373

  • Giampaolo
  • Giampaolo's Avatar
  • OFFLINE
  • Administrator
  • Posts: 465
  • Thank you received: 43
Hi,
for now (perhaps, in future releases) IFile not have support native of "highlight".

If you want create an process of "highlight", you must save the content of document and use a third part library, where you pass the search string and the content.

If you use "lucene" interface, you can configured the "body" field as "Text".
If field "body" is "Text", when get document you can get content indexing.
But if the "body" field is "Text" the index is very big and performance degrades.

If you use "mysqli" interface, the content is stored in DB and you can get (easy) the content.
The problem is then the space on DB is very big
(all textual content of the file is saved in DB), and if you have an hosting with a small DB space you can't use this interface.


One solution for "lucene" interface might be:
You indexing your document with "lucene" interface, whit "body" field "UnStored", and save the content in an file.
Your serch index performance are very high, the delay is read content in the file.

- you must modified one method (for now, IFile not return the object of document):

public function addDocument(Zend_Search_Lucene_Document $doc = null) in IFile_Indexing_Abstract.php and return $doc.
   ....
   // riporta il limite allo stato precedente
   set_time_limit($defaultTimeLimit);
 
   // new istruction    
   return $doc;
}

Now, when you index file:

Exemple (see exemple IFile_Ex01_IndexOneFile.php):
...
// get IFileFactory
$IFileFactory = IFileFactory::getInstance();
// index by Lucene interface
$ifile = $IFileFactory->getIFileIndexing('lucene', $index_path);
// set file of index
$ifile->setIndexFile($file);
// add documento to index
$doc = $ifile->addDocument();
// commit document
$ifile->commit();
 
$content = $doc->body;
$key = $doc->key;
 
// now create file with name, the value of field "key", 
// and content the value of field "body" and save this in your filesystem.
...


When you search, you can get the content from file (using field "key" of result search) and pass "content" and "string search" at library for highlight (see highligth of joomla).
If you like, if it was useful, consider a donation, Thanks
Se vuoi, se ti siamo stati utili, considera una donazione, Grazie
Help us by voting our extensions on Joomla.org:
JiFile
JoomPhoto Mobile
Easy Language
Last Edit: 08 May 2012 18:28 by Giampaolo.
The administrator has disabled public write access.