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-805: async indexing #4

Merged
merged 16 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
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
92 changes: 63 additions & 29 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,95 +18,129 @@ jobs:
fail-fast: false
matrix:
include:
- php: '7.4'
- php: '8.1'
coverage: 'unit'
config: 'phpunit.xml'
- php: '7.4'
- php: '8.1'
coverage: 'integration'
engine: 'legacy'
config: 'phpunit-integration-legacy.xml'
- php: '7.4'

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

- php: '7.4'
- php: '8.1'
coverage: 'integration'
engine: 'solr'
config: 'phpunit-integration-solr.xml'
solr_version: '7.7.3'
solr_cloud: 'yes'
core_setup: 'cloud'
- php: '7.4'

- php: '8.1'
coverage: 'integration'
engine: 'solr'
config: 'phpunit-integration-solr.xml'
solr_version: '8.6.1'
solr_cloud: 'yes'
solr_config: 'vendor/ibexa/solr/src/lib/Resources/config/solr/schema.xml vendor/ibexa/solr/src/lib/Resources/config/solr/language-fieldtypes.xml tests/lib/Resources/config/search/solr/8.6/solrconfig.xml tests/lib/Resources/config/search/solr/custom-fields-types.xml'
core_setup: 'cloud'

- php: '7.4'
config: 'phpunit-core-integration-legacy-solr.xml'
solr_version: '7.7.3'
solr_cores: 'collection1'
core_setup: 'single'
regression: 'regression'
- php: '8.1'
coverage: 'integration'
engine: 'solr'
config: 'phpunit-core-integration-legacy-solr.xml'
solr_version: '7.7.3'
solr_cloud: 'yes'
core_setup: 'cloud'
core_setup: 'dedicated'
regression: 'regression'
- php: '7.4'
- php: '8.1'
coverage: 'integration'
engine: 'solr'
config: 'phpunit-core-integration-legacy-solr.xml'
solr_version: '7.7.3'
core_setup: 'shared'
regression: 'regression'
- php: '7.4'
- php: '8.1'
coverage: 'integration'
engine: 'solr'
config: 'phpunit-core-integration-legacy-solr.xml'
solr_version: '8.6.1'
solr_version: '7.7.3'
solr_cloud: 'yes'
solr_config: 'vendor/ibexa/solr/src/lib/Resources/config/solr/schema.xml vendor/ibexa/solr/src/lib/Resources/config/solr/language-fieldtypes.xml tests/lib/Resources/config/search/solr/8.6/solrconfig.xml tests/lib/Resources/config/search/solr/custom-fields-types.xml'
core_setup: 'cloud'
regression: 'regression'

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

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

steps:
- uses: actions/checkout@v2
Expand All @@ -121,7 +155,7 @@ jobs:
- run: composer --version
- run: composer validate --strict
- run: composer update --prefer-dist
- run: ./bin/.travis/init_solr.sh
- run: ./bin/init_solr.sh
env:
SOLR_VERSION: ${{ matrix.solr_version }}
SOLR_CLOUD: ${{ matrix.solr_cloud }}
Expand Down
10 changes: 6 additions & 4 deletions bin/.travis/init_solr.sh → bin/init_solr.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/usr/bin/env bash

SOLR_VERSION=${SOLR_VERSION:-'8.11.2'}
SOLR_VERSION_SHORT=${SOLR_VERSION%.*}

default_config_files[1]='vendor/ibexa/solr/src/lib/Resources/config/solr/schema.xml'
default_config_files[2]='vendor/ibexa/solr/src/lib/Resources/config/solr/language-fieldtypes.xml'
default_config_files[3]='tests/lib/Resources/config/search/solr/7.7/solrconfig.xml'
default_config_files[3]="tests/lib/Resources/config/search/solr/${SOLR_VERSION_SHORT}/solrconfig.xml"
default_config_files[4]='tests/lib/Resources/config/search/solr/custom-fields-types.xml'

default_cores[0]='core0'
Expand All @@ -17,7 +20,6 @@ default_shards=('shard0')

SOLR_PORT=${SOLR_PORT:-8983}
SOLR_DIR=${SOLR_DIR:-'__solr'}
SOLR_VERSION=${SOLR_VERSION:-'7.7.3'}
SOLR_INSTALL_DIR="${SOLR_DIR}/${SOLR_VERSION}"
SOLR_DEBUG=${SOLR_DEBUG:-false}
SOLR_HOME=${SOLR_HOME:-'ezcloud'}
Expand Down Expand Up @@ -46,7 +48,7 @@ fi
download() {
case ${SOLR_VERSION} in
# PS!!: Append versions and don't remove old once, kernel uses this script!
7.7.3|8.6.1 )
7.7.3|8.11.2 )
url="http://archive.apache.org/dist/lucene/solr/${SOLR_VERSION}/solr-${SOLR_VERSION}.tgz"
;;
*)
Expand Down Expand Up @@ -288,7 +290,7 @@ download

if [ "$SOLR_CLOUD" = "no" ]; then
config_template_dir="${SOLR_INSTALL_DIR}/server/${SOLR_HOME}/template"
"$SCRIPT_DIR"/../../vendor/ibexa/solr/bin/generate-solr-config.sh \
"$SCRIPT_DIR"/../vendor/ibexa/solr/bin/generate-solr-config.sh \
--solr-install-dir="${SOLR_INSTALL_DIR}" \
--solr-version="${SOLR_VERSION}" \
--destination-dir="${config_template_dir}"
Expand Down
12 changes: 12 additions & 0 deletions bundle/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function getConfigTreeBuilder(): TreeBuilder

$this->addIndexableFieldTypeSection($rootNode);
$this->addSearchResultExtractorSection($rootNode);
$this->addAsynchronousIndexingSection($rootNode);

return $treeBuilder;
}
Expand Down Expand Up @@ -61,4 +62,15 @@ private function addSearchResultExtractorSection(ArrayNodeDefinition $nodeDefini
->end()
->end();
}

private function addAsynchronousIndexingSection(ArrayNodeDefinition $nodeDefinition): void
{
$nodeDefinition
->children()
->booleanNode('use_asynchronous_indexing')
->info('Use asynchronous mechanism to handle repository content indexing')
->defaultFalse()
->end()
->end();
}
}
10 changes: 10 additions & 0 deletions bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

use function array_key_exists;

class NetgenIbexaSearchExtraExtension extends Extension
Expand Down Expand Up @@ -69,6 +70,7 @@ private function processExtensionConfiguration(array $configs, ContainerBuilder

$this->processIndexableFieldTypeConfiguration($configuration, $container);
$this->processSearchResultExtractorConfiguration($configuration, $container);
$this->processAsynchronousIndexingConfiguration($configuration, $container);
}

private function processSearchResultExtractorConfiguration(array $configuration, ContainerBuilder $container): void
Expand All @@ -90,4 +92,12 @@ private function processIndexableFieldTypeConfiguration(array $configuration, Co
$configuration['indexable_field_type']['ezrichtext']['short_text_limit'],
);
}

private function processAsynchronousIndexingConfiguration(array $configuration, ContainerBuilder $container): void
{
$container->setParameter(
'netgen_ibexa_search_extra.use_asynchronous_indexing',
$configuration['use_asynchronous_indexing'],
);
}
}
1 change: 1 addition & 0 deletions bundle/NetgenIbexaSearchExtraBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public function build(ContainerBuilder $container): void
$container->addCompilerPass(new Compiler\AggregateContentTranslationSubdocumentMapperPass());
$container->addCompilerPass(new Compiler\AggregateFacetBuilderVisitorPass());
$container->addCompilerPass(new Compiler\AggregateSubdocumentQueryCriterionVisitorPass());
$container->addCompilerPass(new Compiler\AsynchronousIndexingPass());
$container->addCompilerPass(new Compiler\FieldType\RichTextIndexablePass());
$container->addCompilerPass(new Compiler\SearchResultExtractorPass());
$container->addCompilerPass(new Compiler\RawFacetBuilderDomainVisitorPass());
Expand Down
52 changes: 52 additions & 0 deletions bundle/Resources/config/messenger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This is an example Symfony Messenger component configuration for asynchronous indexing.
# Use it if it fits your needs, or create your own as you require.
framework:
messenger:
reset_on_message: true
transports:
netgen_ibexa_asynchronous_indexing:
pspanja marked this conversation as resolved.
Show resolved Hide resolved
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
failure_transport: netgen_ibexa_asynchronous_indexing_failed
retry_strategy:
max_retries: 5
delay: 1000
multiplier: 3
max_delay: 600000
options:
redeliver_timeout: 300
queue_name: netgen_ibexa_asynchronous_indexing
netgen_ibexa_asynchronous_indexing_failed: "doctrine://default?queue_name=netgen_ibexa_asynchronous_indexing_failed"
routing:
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\CopyContent': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\DeleteContent': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\DeleteTranslation': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\HideContent': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\PublishVersion': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\RevealContent': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\UpdateContentMetadata': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\AssignSectionToSubtree': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\CopySubtree': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\CreateLocation': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\DeleteLocation': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\HideLocation': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\MoveSubtree': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\SwapLocation': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\UnhideLocation': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\UpdateLocation': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\ObjectState\SetContentState': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Section\AssignSection': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Trash\Recover': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Trash\Trash': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\AssignUserToUserGroup': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\BeforeUnAssignUserFromUserGroup': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\CreateUserGroup': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\CreateUser': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\DeleteUserGroup': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\DeleteUser': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\MoveUserGroup': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\UnAssignUserFromUserGroup': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\UpdateUserGroup': netgen_ibexa_asynchronous_indexing
'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\UpdateUser': netgen_ibexa_asynchronous_indexing
default_bus: messenger.bus.default
buses:
messenger.bus.default: ~
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
"symfony/proxy-manager-bridge": "^5.4"
},
"require-dev": {
"netgen/ibexa-site-api": "@dev",
"ibexa/fieldtype-richtext": "^4.5",
"ibexa/solr": "^4.5",
"symfony/messenger": "^5.4",
"phpunit/phpunit": "^8.5",
"matthiasnoback/symfony-dependency-injection-test": "^4.1",
"behat/behat": "^3.6.1",
Expand Down
Loading
Loading