-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EZP-31226: Injected MaxDepth into FullText Criteria
* Added MaxDepth parameter for Content and Location FullText Criteria * Set default max depth=2 for integration tests * [SF4 forward compatibility] Implemented factory for IndexingDepthProvider (back-ported from #141) * Refactored max-depth parameter providing Co-authored-by: Andrew Longosz <alongosz@users.noreply.github.com>
- Loading branch information
1 parent
d9d54e3
commit 290b393
Showing
10 changed files
with
185 additions
and
12 deletions.
There are no files selected for viewing
84 changes: 84 additions & 0 deletions
84
lib/Query/Common/CriterionVisitor/Factory/FullTextFactoryAbstract.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace EzSystems\EzPlatformSolrSearchEngine\Query\Common\CriterionVisitor\Factory; | ||
|
||
use eZ\Publish\Core\Search\Common\FieldNameResolver; | ||
use EzSystems\EzPlatformSolrSearchEngine\FieldMapper\IndexingDepthProvider; | ||
use EzSystems\EzPlatformSolrSearchEngine\Query\CriterionVisitor; | ||
use QueryTranslator\Languages\Galach\Generators\ExtendedDisMax; | ||
use QueryTranslator\Languages\Galach\Parser; | ||
use QueryTranslator\Languages\Galach\Tokenizer; | ||
|
||
/** | ||
* Factory for FullText Criterion Visitor. | ||
* | ||
* @see \EzSystems\EzPlatformSolrSearchEngine\Query\Content\CriterionVisitor\FullText | ||
* @see \EzSystems\EzPlatformSolrSearchEngine\Query\Location\CriterionVisitor\FullText | ||
* | ||
* @internal | ||
*/ | ||
abstract class FullTextFactoryAbstract | ||
{ | ||
/** | ||
* Field map. | ||
* | ||
* @var \eZ\Publish\Core\Search\Common\FieldNameResolver | ||
*/ | ||
protected $fieldNameResolver; | ||
|
||
/** | ||
* @var \QueryTranslator\Languages\Galach\Tokenizer | ||
*/ | ||
protected $tokenizer; | ||
|
||
/** | ||
* @var \QueryTranslator\Languages\Galach\Parser | ||
*/ | ||
protected $parser; | ||
|
||
/** | ||
* @var \QueryTranslator\Languages\Galach\Generators\ExtendedDisMax | ||
*/ | ||
protected $generator; | ||
|
||
/** | ||
* @var \EzSystems\EzPlatformSolrSearchEngine\FieldMapper\IndexingDepthProvider | ||
*/ | ||
protected $indexingDepthProvider; | ||
|
||
/** | ||
* Create from content type handler and field registry. | ||
* | ||
* @param \eZ\Publish\Core\Search\Common\FieldNameResolver $fieldNameResolver | ||
* @param \QueryTranslator\Languages\Galach\Tokenizer $tokenizer | ||
* @param \QueryTranslator\Languages\Galach\Parser $parser | ||
* @param \QueryTranslator\Languages\Galach\Generators\ExtendedDisMax $generator | ||
* @param \EzSystems\EzPlatformSolrSearchEngine\FieldMapper\IndexingDepthProvider $indexingDepthProvider | ||
*/ | ||
public function __construct( | ||
FieldNameResolver $fieldNameResolver, | ||
Tokenizer $tokenizer, | ||
Parser $parser, | ||
ExtendedDisMax $generator, | ||
IndexingDepthProvider $indexingDepthProvider | ||
) { | ||
$this->fieldNameResolver = $fieldNameResolver; | ||
$this->tokenizer = $tokenizer; | ||
$this->parser = $parser; | ||
$this->generator = $generator; | ||
$this->indexingDepthProvider = $indexingDepthProvider; | ||
} | ||
|
||
/** | ||
* Create FullText Criterion Visitor. | ||
* | ||
* @return \EzSystems\EzPlatformSolrSearchEngine\Query\CriterionVisitor | ||
*/ | ||
abstract public function createCriterionVisitor(): CriterionVisitor; | ||
} |
39 changes: 39 additions & 0 deletions
39
lib/Query/Content/CriterionVisitor/Factory/ContentFullTextFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace EzSystems\EzPlatformSolrSearchEngine\Query\Content\CriterionVisitor\Factory; | ||
|
||
use EzSystems\EzPlatformSolrSearchEngine\Query\Common\CriterionVisitor\Factory\FullTextFactoryAbstract; | ||
use EzSystems\EzPlatformSolrSearchEngine\Query\Content\CriterionVisitor\FullText; | ||
use EzSystems\EzPlatformSolrSearchEngine\Query\CriterionVisitor; | ||
|
||
/** | ||
* Factory for FullText Criterion Visitor. | ||
* | ||
* @see \EzSystems\EzPlatformSolrSearchEngine\Query\Content\CriterionVisitor\FullText | ||
* | ||
* @internal | ||
*/ | ||
final class ContentFullTextFactory extends FullTextFactoryAbstract | ||
{ | ||
/** | ||
* Create FullText Criterion Visitor. | ||
* | ||
* @return \EzSystems\EzPlatformSolrSearchEngine\Query\CriterionVisitor|\EzSystems\EzPlatformSolrSearchEngine\Query\Content\CriterionVisitor\FullText | ||
*/ | ||
public function createCriterionVisitor(): CriterionVisitor | ||
{ | ||
return new FullText( | ||
$this->fieldNameResolver, | ||
$this->tokenizer, | ||
$this->parser, | ||
$this->generator, | ||
$this->indexingDepthProvider->getMaxDepth() | ||
); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
lib/Query/Location/CriterionVisitor/Factory/LocationFullTextFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace EzSystems\EzPlatformSolrSearchEngine\Query\Location\CriterionVisitor\Factory; | ||
|
||
use EzSystems\EzPlatformSolrSearchEngine\Query\Common\CriterionVisitor\Factory\FullTextFactoryAbstract; | ||
use EzSystems\EzPlatformSolrSearchEngine\Query\CriterionVisitor; | ||
use EzSystems\EzPlatformSolrSearchEngine\Query\Location\CriterionVisitor\FullText; | ||
|
||
/** | ||
* Factory for FullText Criterion Visitor. | ||
* | ||
* @see \EzSystems\EzPlatformSolrSearchEngine\Query\Content\CriterionVisitor\FullText | ||
* | ||
* @internal | ||
*/ | ||
final class LocationFullTextFactory extends FullTextFactoryAbstract | ||
{ | ||
/** | ||
* Create FullText Criterion Visitor. | ||
* | ||
* @return \EzSystems\EzPlatformSolrSearchEngine\Query\CriterionVisitor|\EzSystems\EzPlatformSolrSearchEngine\Query\Location\CriterionVisitor\FullText | ||
*/ | ||
public function createCriterionVisitor(): CriterionVisitor | ||
{ | ||
return new FullText( | ||
$this->fieldNameResolver, | ||
$this->tokenizer, | ||
$this->parser, | ||
$this->generator, | ||
$this->indexingDepthProvider->getMaxDepth() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters