Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ngstack 836 descendant indexing #11

Open
wants to merge 70 commits into
base: 3.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
385c9b8
NGSTACK-836 parent child indexer
Mar 22, 2024
7b82532
NGSTACK-836 remove SearchResultExtractorTrait from ParentChildFieldMa…
Mar 25, 2024
a3b6d75
NGSTACK-836 remove argument from service definition
Mar 25, 2024
34cab02
NGSTACK-836 add parent child indexing compiler pass
Mar 25, 2024
9e9162a
NGSTACK-836 service definition changes
Mar 28, 2024
0709a0d
NGSTACK-836 FulltextFieldResolver interface and remove search from Pa…
Mar 28, 2024
603e375
NGSTACK-836 use persistence location handler instead of location service
Mar 28, 2024
89fff6d
NGSTACK-836 add content id as key to parent ids property and unset pr…
Mar 28, 2024
1efebab
NGSTACK-836 replace persistance handler with location handler, use in…
Mar 28, 2024
2b6c310
NGSTACK-836: use class constant instead of FQCN
pspanja May 29, 2024
092ecae
NGSTACK-836: add strict types declaration and fix CS
pspanja May 29, 2024
0cd3913
NGSTACK-836: add property type annotation and fix CS
pspanja May 29, 2024
de8d585
NGSTACK-836: fix CS
pspanja May 29, 2024
181851a
NGSTACK-836: fix CS
pspanja May 29, 2024
1c560c1
NGSTACK-836: remove unused imports
pspanja May 29, 2024
02f3088
NGSTACK-836: add strict types declaration and fix CS
pspanja May 29, 2024
05b0490
NGSTACK-836: use getters instead of magic get and fix CS
pspanja May 29, 2024
96531ac
NGSTACK-836: fix case mismatch
pspanja May 29, 2024
d4cf4e0
NGSTACK-836: clean up docblocks
pspanja May 29, 2024
d4aa014
NGSTACK-836: remove unnecessary type cast
pspanja May 29, 2024
0f792ad
NGSTACK-836: clean up docblocks
pspanja May 29, 2024
0201bf0
NGSTACK-836: fix CS
pspanja May 29, 2024
a2d5383
NGSTACK-836: fix spacing
pspanja May 29, 2024
f5f2026
NGSTACK-836: move configuration to the bottom
pspanja May 29, 2024
c62c84e
NGSTACK-836: fix CS
pspanja May 29, 2024
aa89585
NGSTACK-836: fix typo
pspanja May 29, 2024
e18ecc5
NGSTACK-836: fix async indexing tests and prepare for testing parent-…
pspanja May 29, 2024
965810b
NGSTACK-836: check and skip root Location
pspanja May 29, 2024
1aeaef6
NGSTACK-836: handle exception when resolving content type identifier
pspanja May 29, 2024
95b5383
NGSTACK-836: restructure message handlers
pspanja May 29, 2024
af508f9
NGSTACK-836: restructure parent-child indexing field mapper
pspanja May 29, 2024
33defd2
NGSTACK-836: restructure parent-child indexing ancestor resolver
pspanja May 29, 2024
043c4ed
NGSTACK-836: fix test service configuration
pspanja May 29, 2024
2cb105e
NGSTACK-836: add parent-child indexing test for publishing version
pspanja May 29, 2024
e22ccd6
NGSTACK-836: fix CS
pspanja May 31, 2024
315a1ab
NGSTACK-836: update test class name
pspanja May 31, 2024
c3f6028
NGSTACK-836: rename parent-child indexing fulltext field mapper
pspanja May 31, 2024
f0e54c5
NGSTACK-836: make parent-child fulltext field mapper configurable
pspanja May 31, 2024
3fbf1f9
NGSTACK-836: implement recursive semantic config
pspanja Jun 3, 2024
12926a3
NGSTACK-836: extract AncestorPathGenerator with test
pspanja Jun 4, 2024
8a1f388
NGSTACK-836: fix indenting
pspanja Jun 6, 2024
ce83731
NGSTACK-836: fix logged message
pspanja Jun 6, 2024
55f27af
NGSTACK-836: add AncestorResolver unit test
pspanja Jun 6, 2024
05f6353
NGSTACK-836: disable hierarchical indexing on legacy and asynchronous…
pspanja Jun 6, 2024
1dcb5d0
NGSTACK-836: fix exclude configuration
pspanja Jun 6, 2024
3662e72
NGSTACK-836: fix service configuration
pspanja Jun 6, 2024
d6bc30c
NGSTACK-836: fix case mismatch
pspanja Jun 6, 2024
0ab45f7
NGSTACK-836: update for change in configuration
pspanja Jun 6, 2024
189ed5c
NGSTACK-836: implement configurable Solr field handlers for descendan…
pspanja Jun 7, 2024
f227bf0
NGSTACK-836: rename parent child indexing to descendant indexing
pspanja Jun 10, 2024
a6d6aee
NGSTACK-836: rename parent child indexing to descendant indexing part 2
pspanja Jun 10, 2024
ad5476c
NGSTACK-836: add Block and BlockTranslation Descendant FieldMappers
pspanja Jun 11, 2024
2fe6d6d
NGSTACK-836: rename cleanup
pspanja Jun 11, 2024
abc846b
NGSTACK-836: fix CS
pspanja Jun 11, 2024
84d443d
NGSTACK-836 tests for descendant indexing
Jul 11, 2024
0a195c3
NGSTACK-836 AncestorIndexer and AncestorResolver changes and swap loc…
Jul 11, 2024
11f18a5
NGSTACK-836 remove unused qualifiers
Jul 11, 2024
dea79ff
NGSTACK-836 exclude descendant indexing tests (not supported with leg…
Jul 11, 2024
f95b258
NGSTACK-836 update tests throws tags
Jul 11, 2024
eb2cecb
NGSTACK-836 declare test return types
Jul 12, 2024
c5b7c37
NGSTACK-836 remove unnecessary code
Jul 12, 2024
5dcb6ad
NGSTACK-836 renaming field mappers and custom solr fields
Jul 12, 2024
8517964
NGSTACK-836 fix handlers configuration
Jul 18, 2024
113a696
NGSTACK-836 add documentation for descendant indexing
Jul 30, 2024
9014f2e
NGSTACK-836 documentation changes
Aug 2, 2024
d048105
NGSTACK-836 exclude descendant indexing from integration legacy tests
Aug 14, 2024
720d633
NGSTACK-836 comment NameSchemaSubscriber line
Aug 14, 2024
a457c11
NGSTACK-836 exclude tests fix path
Aug 14, 2024
0d1f267
NGSTACK-836 exclude DescendantIndexingSectionTest
Aug 16, 2024
e3264c0
NGSTACK-836 documentation fix
Sep 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 133 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
tests:
name: ${{ matrix.php }} ${{ matrix.coverage }} ${{ matrix.engine }} ${{ matrix.solr_version }} ${{ matrix.regression }} ${{ matrix.core_setup }}
name: ${{ matrix.php }} ${{ matrix.coverage }} ${{ matrix.engine }} ${{ matrix.solr_version }} ${{ matrix.regression }} ${{ matrix.asynchronous }} ${{ matrix.core_setup }}
runs-on: ubuntu-latest
env:
extensions: pdo_sqlite
Expand Down Expand Up @@ -53,6 +53,37 @@ jobs:
solr_cloud: 'yes'
core_setup: 'cloud'

- php: '8.1'
coverage: 'integration'
engine: 'solr'
config: 'phpunit-integration-solr-asynchronous.xml'
solr_version: '7.7.3'
solr_cores: 'collection1'
core_setup: 'single'
asynchronous: 'asynchronous'
- php: '8.1'
coverage: 'integration'
engine: 'solr'
config: 'phpunit-integration-solr-asynchronous.xml'
solr_version: '7.7.3'
core_setup: 'dedicated'
asynchronous: 'asynchronous'
- php: '8.1'
coverage: 'integration'
engine: 'solr'
config: 'phpunit-integration-solr-asynchronous.xml'
solr_version: '7.7.3'
core_setup: 'shared'
asynchronous: 'asynchronous'
- php: '8.1'
coverage: 'integration'
engine: 'solr'
config: 'phpunit-integration-solr-asynchronous.xml'
solr_version: '7.7.3'
solr_cloud: 'yes'
core_setup: 'cloud'
asynchronous: 'asynchronous'

- php: '8.1'
coverage: 'integration'
engine: 'solr'
Expand Down Expand Up @@ -84,6 +115,41 @@ jobs:
core_setup: 'cloud'
regression: 'regression'

- php: '8.1'
coverage: 'integration'
engine: 'solr'
config: 'phpunit-core-integration-legacy-solr-asynchronous.xml'
solr_version: '7.7.3'
solr_cores: 'collection1'
core_setup: 'single'
regression: 'regression'
asynchronous: 'asynchronous'
- php: '8.1'
coverage: 'integration'
engine: 'solr'
config: 'phpunit-core-integration-legacy-solr-asynchronous.xml'
solr_version: '7.7.3'
core_setup: 'dedicated'
regression: 'regression'
asynchronous: 'asynchronous'
- php: '8.1'
coverage: 'integration'
engine: 'solr'
config: 'phpunit-core-integration-legacy-solr-asynchronous.xml'
solr_version: '7.7.3'
core_setup: 'shared'
regression: 'regression'
asynchronous: 'asynchronous'
- php: '8.1'
coverage: 'integration'
engine: 'solr'
config: 'phpunit-core-integration-legacy-solr-asynchronous.xml'
solr_version: '7.7.3'
solr_cloud: 'yes'
core_setup: 'cloud'
regression: 'regression'
asynchronous: 'asynchronous'

- php: '8.1'
coverage: 'integration'
engine: 'solr'
Expand Down Expand Up @@ -111,6 +177,37 @@ jobs:
solr_cloud: 'yes'
core_setup: 'cloud'

- php: '8.1'
coverage: 'integration'
engine: 'solr'
config: 'phpunit-integration-solr-asynchronous.xml'
solr_version: '8.11.2'
solr_cores: 'collection1'
core_setup: 'single'
asynchronous: 'asynchronous'
- php: '8.1'
coverage: 'integration'
engine: 'solr'
config: 'phpunit-integration-solr-asynchronous.xml'
solr_version: '8.11.2'
core_setup: 'dedicated'
asynchronous: 'asynchronous'
- php: '8.1'
coverage: 'integration'
engine: 'solr'
config: 'phpunit-integration-solr-asynchronous.xml'
solr_version: '8.11.2'
core_setup: 'shared'
asynchronous: 'asynchronous'
- php: '8.1'
coverage: 'integration'
engine: 'solr'
config: 'phpunit-integration-solr-asynchronous.xml'
solr_version: '8.11.2'
solr_cloud: 'yes'
core_setup: 'cloud'
asynchronous: 'asynchronous'

- php: '8.1'
coverage: 'integration'
engine: 'solr'
Expand Down Expand Up @@ -142,6 +239,41 @@ jobs:
core_setup: 'cloud'
regression: 'regression'

- php: '8.1'
coverage: 'integration'
engine: 'solr'
config: 'phpunit-core-integration-legacy-solr-asynchronous.xml'
solr_version: '8.11.2'
solr_cores: 'collection1'
core_setup: 'single'
regression: 'regression'
asynchronous: 'asynchronous'
- php: '8.1'
coverage: 'integration'
engine: 'solr'
config: 'phpunit-core-integration-legacy-solr-asynchronous.xml'
solr_version: '8.11.2'
core_setup: 'dedicated'
regression: 'regression'
asynchronous: 'asynchronous'
- php: '8.1'
coverage: 'integration'
engine: 'solr'
config: 'phpunit-core-integration-legacy-solr-asynchronous.xml'
solr_version: '8.11.2'
core_setup: 'shared'
regression: 'regression'
asynchronous: 'asynchronous'
- php: '8.1'
coverage: 'integration'
engine: 'solr'
config: 'phpunit-core-integration-legacy-solr-asynchronous.xml'
solr_version: '8.11.2'
solr_cloud: 'yes'
core_setup: 'cloud'
regression: 'regression'
asynchronous: 'asynchronous'

steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
Expand Down
112 changes: 109 additions & 3 deletions bundle/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;

class Configuration implements ConfigurationInterface
{
Expand All @@ -25,6 +26,7 @@ public function getConfigTreeBuilder(): TreeBuilder
$this->addIndexableFieldTypeSection($rootNode);
$this->addSearchResultExtractorSection($rootNode);
$this->addAsynchronousIndexingSection($rootNode);
$this->addHierarchicalIndexingSection($rootNode);

return $treeBuilder;
}
Expand All @@ -45,7 +47,7 @@ private function addIndexableFieldTypeSection(ArrayNodeDefinition $nodeDefinitio
->info("Maximum number of characters for the indexed short text ('value' string type field)")
->defaultValue(256)
->end()
->end()
?->end()
->end()
->end()
->end()
Expand All @@ -60,7 +62,7 @@ private function addSearchResultExtractorSection(ArrayNodeDefinition $nodeDefini
->info('Get search result objects by loading them from the persistence layer, instead of reconstructing them from the returned Solr data')
->defaultTrue()
->end()
->end();
?->end();
}

private function addAsynchronousIndexingSection(ArrayNodeDefinition $nodeDefinition): void
Expand All @@ -71,6 +73,110 @@ private function addAsynchronousIndexingSection(ArrayNodeDefinition $nodeDefinit
->info('Use asynchronous mechanism to handle repository content indexing')
->defaultFalse()
->end()
->end();
?->end();
}

private function addHierarchicalIndexingSection(ArrayNodeDefinition $nodeDefinition): void
{
$childrenNodeDefinition = $nodeDefinition
->children()
->arrayNode('hierarchical_indexing')
->info('Hierarchical indexing configuration')
->addDefaultsIfNotSet()
->children()
->arrayNode('descendant_indexing')
->info('Descendant indexing configuration')
->addDefaultsIfNotSet()
->children()
->booleanNode('enabled')
->info('Enable/disable descendant indexing')
->defaultFalse()
->end()
?->arrayNode('map')
->useAttributeAsKey('name')
->normalizeKeys(false)
->arrayPrototype()
->children()
->arrayNode('handlers')
->info('List of indexing handlers to execute')
->example([
'handler_identifier_1',
'handler_identifier_2',
])
->scalarPrototype()
->defaultValue([])
->validate()
->ifTrue(fn ($v) => !is_string($v))
->thenInvalid('Handler identifier must be a string.')
->end()
->end()
?->end()
?->arrayNode('children')
->useAttributeAsKey('name')
->normalizeKeys(false)
->arrayPrototype()
;

$this->buildChildrenNode($childrenNodeDefinition);
}

private function evaluateChildren(&$child, $name): void
{
$builder = new TreeBuilder($name, 'array');
$root = $builder->getRootNode();

$this->buildChildrenNode($root);

$root->getNode(true)->finalize($child);
}

private function buildChildrenNode(ArrayNodeDefinition $node): void
{
$node
->addDefaultsIfNotSet()
->children()
->booleanNode('indexed')
->info('Whether the node should be indexed')
->defaultTrue()
->end()
?->variableNode('children')
->defaultValue([])
->validate()
->ifTrue(fn ($v) => !is_array($v))
->thenInvalid('The children element must be an array.')
->end()
->validate()
->always(
function ($children) {
array_walk($children, $this->evaluateChildren(...));

return $children;
}
)
->end()
->end()
?->end()
->validate()
->always(
function ($children) {
foreach (array_keys($children) as $key) {
$allowedOptions = ['indexed', 'children'];

if (!in_array($key, $allowedOptions, true)) {
throw new InvalidConfigurationException(
sprintf(
'Unrecognized option "%s". Available options are "%s".',
$key,
implode('", "', $allowedOptions),
),
);
}
}

return $children;
}
)
->end()
;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ private function processExtensionConfiguration(array $configs, ContainerBuilder
$this->processIndexableFieldTypeConfiguration($configuration, $container);
$this->processSearchResultExtractorConfiguration($configuration, $container);
$this->processAsynchronousIndexingConfiguration($configuration, $container);
$this->processDescendantIndexingConfiguration($configuration, $container);
}

private function processSearchResultExtractorConfiguration(array $configuration, ContainerBuilder $container): void
Expand Down Expand Up @@ -117,4 +118,12 @@ private function processAsynchronousIndexingConfiguration(array $configuration,
$configuration['use_asynchronous_indexing'],
);
}

private function processDescendantIndexingConfiguration(array $configuration, ContainerBuilder $container): void
{
$container->setParameter(
'netgen.ibexa_search_extra.descendant_indexing.configuration',
$configuration['hierarchical_indexing']['descendant_indexing'],
);
}
}
2 changes: 2 additions & 0 deletions bundle/NetgenIbexaSearchExtraBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Netgen\Bundle\IbexaSearchExtraBundle;

use Netgen\IbexaSearchExtra\Container\Compiler;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

Expand All @@ -21,6 +22,7 @@ public function build(ContainerBuilder $container): void
$container->addCompilerPass(new Compiler\AggregateFacetBuilderVisitorPass());
$container->addCompilerPass(new Compiler\AggregateSubdocumentQueryCriterionVisitorPass());
$container->addCompilerPass(new Compiler\AsynchronousIndexingPass());
$container->addCompilerPass(new Compiler\DescendantIndexingPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 100);
$container->addCompilerPass(new Compiler\FieldType\RichTextIndexablePass());
$container->addCompilerPass(new Compiler\SearchResultExtractorPass());
$container->addCompilerPass(new Compiler\RawFacetBuilderDomainVisitorPass());
Expand Down
Loading
Loading