From afa4c215554bc1d47656fb68e0ff45e51fe881a6 Mon Sep 17 00:00:00 2001 From: Andrew Longosz Date: Mon, 17 Jun 2019 19:38:36 +0200 Subject: [PATCH] [SF4] Implemented factory for IndexingDepthProvider Symfony 4 no longer allows using private services in DIC @=service expressions so we need to provide factory instead. --- .../Factory/FullTextFactory.php | 92 +++++++++++++++++++ .../container/solr/criterion_visitors.yml | 9 +- 2 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 lib/Query/Content/CriterionVisitor/Factory/FullTextFactory.php diff --git a/lib/Query/Content/CriterionVisitor/Factory/FullTextFactory.php b/lib/Query/Content/CriterionVisitor/Factory/FullTextFactory.php new file mode 100644 index 000000000..9a76b6553 --- /dev/null +++ b/lib/Query/Content/CriterionVisitor/Factory/FullTextFactory.php @@ -0,0 +1,92 @@ +fieldNameResolver = $fieldNameResolver; + $this->tokenizer = $tokenizer; + $this->parser = $parser; + $this->generator = $generator; + $this->indexingDepthProvider = $indexingDepthProvider; + } + + /** + * Create FullText Criterion Visitor. + * + * @return \EzSystems\EzPlatformSolrSearchEngine\Query\Content\CriterionVisitor\FullText + */ + public function createCriterionVisitor(): FullText + { + return new FullText( + $this->fieldNameResolver, + $this->tokenizer, + $this->parser, + $this->generator, + $this->indexingDepthProvider->getMaxDepth() + ); + } +} diff --git a/lib/Resources/config/container/solr/criterion_visitors.yml b/lib/Resources/config/container/solr/criterion_visitors.yml index 32791d2b1..bfc3800e8 100644 --- a/lib/Resources/config/container/solr/criterion_visitors.yml +++ b/lib/Resources/config/container/solr/criterion_visitors.yml @@ -258,14 +258,17 @@ services: ezpublish.search.solr.query.content.criterion_visitor.full_text: class: "%ezpublish.search.solr.query.content.criterion_visitor.full_text.class%" + factory: ['@EzSystems\EzPlatformSolrSearchEngine\Query\Content\CriterionVisitor\Factory\FullTextFactory', 'createCriterionVisitor'] + tags: + - {name: ezpublish.search.solr.query.content.criterion_visitor} + + EzSystems\EzPlatformSolrSearchEngine\Query\Content\CriterionVisitor\Factory\FullTextFactory: arguments: - "@ezpublish.search.common.field_name_resolver" - "@ezpublish.search.solr.query.query_translator.galach.tokenizer" - "@ezpublish.search.solr.query.query_translator.galach.parser" - "@ezpublish.search.solr.query.query_translator.galach.generator.edismax" - - "@=service('ezpublish.search.solr.field_mapper.indexing_depth_provider').getMaxDepth()" - tags: - - {name: ezpublish.search.solr.query.content.criterion_visitor} + - "@ezpublish.search.solr.field_mapper.indexing_depth_provider" ezpublish.search.solr.query.content.criterion_visitor.visibility: class: "%ezpublish.search.solr.query.content.criterion_visitor.visibility.class%"