Find the Exponential Software extensions you want
UNIX name | Owner | Status |
---|---|---|
ezfindsearchenginebundle | 7x | stable |
Version | Compatible with |
---|---|
N/A | N/A |
This bundle introduces a wrapper around the legacy eZFind search engine, making it available to developers with the
same search API available by default in eZ Publish 5.
You can install the bundle using Composer:
composer require kaliop/ezfindsearchenginebundle
and then enabling it in your kernel.
The bundle comes fully configured by default. Here the complete list of parameters available with example values:
ezfind_search_engine.search_settings.boost_functions:
- 'recip(ms(NOW/HOUR,attr_publication_date_dt),4e-12,1000,2)'
# default list of fields returned when *not* returning Contents
ezfind_search_engine.search_settings.fields_to_return:
- meta_name_t
- meta_owner_name_t
- meta_path_string_ms
- meta_priority_si
- meta_score_value:score # Score field needs to be renamed as it won't be passed from eZFind
# in case you want to use an alternative 'legacy fetch function' to power the search service. The default is ezfind/search
ezfind_search_engine.search_settings.legacy_function_handler.module_name: 'ezfind'
ezfind_search_engine.search_settings.legacy_function_handler.function_name: 'search'
The simplest way to use this bundle is to simply swap the Search Service that you use for existing queries with the new
one:
...
For more advanced features, you can swap the Query object with one of a more specific class. This allows you to set more
query parameters, f.e. to speed up the execution of the query by disabling unneeded features
...
Currently the following FacetBuilders are implemented by the bundle:
use eZ\Publish\API\Repository\Values\Content\Query\FacetBuilder;
use Kaliop\EzFindSearchEngineBundle\API\Repository\Values\Content\Query\FacetBuilder as KaliopFacetBuilder;
$now = new DateTime();
$yearAgo = new DateTime();
$yearAgo->modify('-1 year');
$query->facetBuilders = [
// Kaliop Facet Builders
new KaliopFacetBuilder\FieldRangeFacetBuilder([
'name' => 'Numeric field range facet',
'fieldPath' => 'product/price',
'start' => 100,
'end' => 500,
'gap' => 50,
'limit' => 8,
]),
new KaliopFacetBuilder\DateRangeFacetBuilder([
'name' => 'Date range facet',
'fieldPath' => 'article/publication_date',
'start' => $yearAgo,
'end' => $now,
'gap' => new DateInterval('P1M'),
'limit' => 12,
]),
// Base eZ Facet Builders
new FacetBuilder\FieldFacetBuilder([
'name' => 'Simple field facet',
'fieldPaths' => 'article/title',
'limit' => 20,
]),
new FacetBuilder\FieldFacetBuilder([
'name' => 'Object relation(s) facet',
'fieldPaths' => 'article/author/id',
'limit' => 20,
]),
new FacetBuilder\ContentTypeFacetBuilder([
'name' => 'Content type facet',
]),
new FacetBuilder\CriterionFacetBuilder([
'name' => 'Criterion facet',
'filter' => new Criterion\Field('article/title', Criterion\Operator::CONTAINS, 'new'),
]),
];
The bundle utilises a series of 'handlers' to convert the search Query into legacy search configuration to be sent to
Solr.
You can add more custom handlers using tagged services, with the following tags:
These are supposed to convert criteria that will be added to the "filter" section of the eZFind call (or to the query
string when sorting by score)
These are supposed to convert sort clauses
...
Special tahnks to SOkamoto (who got this all started), CRevillo, DClements, MIwaniak, SKlimaszewski