Search engine
Exponential has a built-in search engine that indexes the content as it is published. It searches the attributes that are marked searchable, with filters by class, attribute, subtree, section and date. A Solr-based engine, ezfind, can replace it when you need relevance ranking, highlighting or facets.
What is indexed
Each class attribute has a Searchable checkbox (Setup > Classes, edit the class). When an object is published, the text of its searchable attributes is added to the index. Some datatypes cannot be indexed; their checkbox has no effect.
Indexing happens during the publish unless it is delayed. With delayed indexing, the publish only queues the object and the cronjob part that runs cronjobs/indexcontent.php (in the default cronjob group) indexes it later:
[SearchSettings] # enabled, disabled (the default) or classbased DelayedIndexing=classbased # with classbased: the classes whose objects are indexed later DelayedIndexingClassList[]=article
Searching
- Simple search (content/search) finds objects that contain all the words typed; the order of the words does not matter.
- Advanced search (content/advancedsearch) adds an exact phrase field and filters by class, attribute, subtree, section and publishing date (yesterday, last week, last month, last three months, last year).
- The operators AND and OR are not understood; several words always mean all of them.
Settings
All in site.ini [SearchSettings]. The shipped values:
[SearchSettings] # the search engine class; ezfind sets its own SearchEngine=eZSearchEngine # default: the view searches; template: the template does SearchViewHandling=default # record search phrases for Setup > Search statistics (they can hold personal data) LogSearchStats=disabled # the largest limit a visitor may ask for MaximumSearchLimit=30 # longer search texts are cut to this many words and characters MaximumSearchTextWords=16 MaximumSearchTextLength=1024 AllowEmptySearch=disabled # "demo*" finds words that start with demo; costs much more time EnableWildcard=false MinCharacterWildcard=3 # stop words: words found in more than StopWordThresholdPercent % of the objects # are left out of a search, once there are more than StopWordThresholdValue objects StopWordThresholdValue=100 StopWordThresholdPercent=60 DelayedIndexing=disabled DelayedIndexingClassList[] ExtensionDirectories[]
With EnableWildcard=true the asterisk is accepted only at the end of a word (demo*), and the word before it must have at least MinCharacterWildcard characters.
Search statistics
Setup > Search statistics (/search/stats) lists the phrases visitors searched for, how often, how many results they found on average and which found nothing. Phrases are recorded only in siteaccesses that set LogSearchStats=enabled; the page names them. Reset statistics removes all recorded phrases.
Setup > Search statistics (/search/stats): which phrases visitors searched for, how often and with how many results; only siteaccesses with LogSearchStats=enabled record them.
Rebuilding the index
After changing which attributes are searchable, or after an import, rebuild the index:
# --clean removes all search data first ./console exp:updatesearchindex --clean --allow-root-user # the same script php bin/php/updatesearchindex.php --clean
Solr with ezfind
ezfind is not part of a new installation; Composer suggests it (composer require se7enxweb/ezfind:~3.0.11). Once it is installed and active it brings its own commands (ext:ezfind:updatesearchindexsolr, ext:ezfind:ezsolrcommit, ext:ezfind:ezsolroptimize). ./console exp:solr status controls a Solr server configured in solr.ini [SolrSettings]; see Server control commands.
Limits
- No relevance ranking and no highlighting in the built-in engine.
- Wildcards only at the end of a word, and only when switched on.
- Search statistics are off by default.
Related pages
Contributors
- Balazs Halasy
- Andrea Melo Maintainer
- Geir Arne Waaler Maintainer
- Graham Brookins Updated Maintainer
Comments
Add a comment