Search engine integration
This page is for integrators who must improve or replace the site search, or feed content into a search service the
customer already runs. Search in Exponential is a pluggable engine: the kernel calls eZSearch, which hands every
add, remove and query to the engine named in site.ini [SearchSettings] SearchEngine.
Contents
- The parts
- Option A: the built-in engine
- Option B: Solr through ezfind
- Option C: a search engine plugin of your own
- Option D: an external index next to the site search
- Indexing after imports
- Search over the APIs
The parts
| Part | Where |
|---|---|
| The engine setting | site.ini [SearchSettings] SearchEngine=eZSearchEngine |
| The interface every engine implements | ezpSearchEngine (kernel/private/interfaces/ezpsearchengine.php): addObject(), removeObject(), removeObjectById(), search(), supportedSearchTypes(), needCommit(), needRemoveWithUpdate(), commit() |
| Where engines are looked for | kernel/search/plugins/<name>/<name>.php, then extension/<ext>/search/plugins/<name>/<name>.php for each extension in [SearchSettings] ExtensionDirectories[] (eZSearch::getEngine()) |
| Delayed indexing | [SearchSettings] DelayedIndexing (disabled, enabled or classbased with DelayedIndexingClassList[]); the global cronjob script indexcontent.php indexes what was queued |
| Full reindex | php bin/php/updatesearchindex.php (--clean empties the index first) |
Option A: the built-in engine
eZSearchEngine indexes words in database tables. It needs nothing else to run and is enough for small and
medium sites. Statistics of search phrases are off by default (LogSearchStats=disabled), because they can hold
personal data.
Option B: Solr through ezfind
The ezfind extension connects the site search to Apache Solr (facets, relevance tuning, the content of files). It is
not in the require list of the root composer.json; install it separately and check its state before you
promise it. The kernel's exp:solr command controls a Solr server once solr.ini [SolrSettings] Enabled=true:
php bin/php/console exp:solr status --allow-root-user
php bin/php/console exp:solr ping --allow-root-userRead Search with ezfind and Solr and Server control commands.
Option C: a search engine plugin of your own
To make the site search use another service (OpenSearch, Elasticsearch, a SaaS search), write a class that
implements ezpSearchEngine in your extension:
extension/myintegration/search/plugins/myintegrationsearch/myintegrationsearch.php class myIntegrationSearch# settings/override/site.ini.append.php
[SearchSettings]
SearchEngine=myIntegrationSearch
ExtensionDirectories[]=myintegrationThe directory and file name are the engine name in lower case; the class name is the setting's value. Everything that
calls the search (the search page, fetch( 'content', 'search', ... ), the expsearch services) then uses your
engine, and every publish and remove calls addObject() and removeObject(). This is the deepest integration and the
largest piece of work: the search page templates expect the result structure of the built-in engine.
Option D: an external index next to the site search
Often the customer's enterprise search only needs to receive content, while the site keeps its own search. Then do not replace the engine: send publications to the external index with an outbox (Workflows and triggers as hooks), removals with the audit webhook or the same outbox, and let a cronjob part deliver them. A full reload is a server-side export (Writing an export).
Indexing after imports
| Situation | Do |
|---|---|
An import created objects through eZContentFunctions | Nothing: publishing indexes them (or queues them with delayed indexing) |
| Delayed indexing is on | Make sure the global cronjob part runs (indexcontent.php) |
A package was installed with ezpm.php | The installer delays indexing: run php bin/php/updatesearchindex.php |
| Data was changed outside the publish operation | Run php bin/php/updatesearchindex.php; better, do not change data that way |
Search over the APIs
The REST API has no search route. expservices has expsearch::search, count, facets, byClass, inSubtree,
bySection, byAttribute, suggest and engine (which engine is in use), each checked against content/read
(Remote services with expservices).
Related pages
- Search backends for hosts
- Search with ezfind and Solr
- Searching
- Caching after imports
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.