Share » Learn » eZ Publish » Advanced development with eZ Find -...

Advanced development with eZ Find - part 1 : Datatypes in Solr and eZ Find

Monday 07 June 2010 8:05:08 am

  • Currently 5 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Step 2 : How eZ Find pushes content from eZ Publish to Solr

Here is the code execution flow when an eZ Publish content object is added/updated:

  • Execution of the registerSearchObject method, from the eZContentOperationCollection class. If DelayedIndexing is enabled (see details below) : insertion of the objectID in the 'ezpending_actions' table for later indexing.
  • If DelayedIndexing is disabled, the concerned content object is fetched, and transmitted to the eZSearch::addObject( $object, $needCommit ) method.
  • If eZ Find is installed and enabled, call of the eZSolr::addObject( $contentObject, $commit = true ) method.

eZ Find, a search plug-in

eZ Find was built-in as an eZ Publish search plug-in, system in which the /content/search view was natively built to be externalized under the form of a search plug-in. Thus, in the eZ Find extension, the /ezfind/settings/site.ini.append.php file declares eZ Find as a search plug-in :

[SearchSettings]
SearchEngine=ezsolr

The getEngine() method (kernel/classes/ezsearch.php) then takes care of retrieving the associated PHP class, to interface the search plug-in, namely /search/plugins/ezsolr/ezsolr.php in our case.

eZ Find and the native DelayedIndexing mechanism

For every content update operation, the addObject method of the eZSolr class is invoked. This plug-in-based way of functioning allows to inherit from other native features of eZ Publish's search, like the DelayedIndexing one, which gives the possibility to make asynchronous content indexing (globally or per content class). This mechanism relies on a scheduled task (cronjob) : indexcontent.php :

[SearchSettings]
DelayedIndexing=disabled|enabled|classbased
DelayedIndexingClassList[]
DelayedIndexingClassList[]=mycontentclass

Note :

This technique is particularly efficient when it comes to optimizing the back office response time (and consequently : the user experience), or regular content imports. However, the DelayedIndexing technique suffers from a few limitations : it is generic (read : not specifically optimized for eZ Find), and merely loops over the entries of the 'ezpending_actions' table to index the objects, without using Solr finesses like batch-indexing of content, followed by a single 'commit'.

 

Printable

Printer Friendly version of the full article on one page with plain styles

Author(s)