roadiz / solr-bundle
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Type:symfony-bundle
Requires
- php: >=8.3
- ext-ctype: *
- ext-iconv: *
- ext-json: *
- ext-mbstring: *
- ext-zip: *
- doctrine/orm: ~2.20.0
- nelmio/solarium-bundle: ^5.1
- roadiz/core-bundle: 2.6.x-dev
- roadiz/documents: 2.6.x-dev
- solarium/solarium: ^6.3.6
- symfony/cache: 6.4.*
- symfony/console: 6.4.*
- symfony/dotenv: 6.4.*
- symfony/flex: ^2.4.7
- symfony/framework-bundle: 6.4.*
- symfony/messenger: 6.4.*
- symfony/serializer: 6.4.*
- symfony/string: 6.4.*
- symfony/workflow: 6.4.*
Requires (Dev)
- php-coveralls/php-coveralls: ^2.4
- phpstan/phpdoc-parser: <2
- phpstan/phpstan: ^1.5.3
- phpstan/phpstan-doctrine: ^1.3
- phpunit/phpunit: ^9.5
- symfony/phpunit-bridge: ^7.0
- symfony/stopwatch: 6.4.*
This package is auto-updated.
Last update: 2025-06-12 09:14:33 UTC
README
Installation
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
Applications that use Symfony Flex
Open a command console, enter your project directory and execute:
$ composer require roadiz/solr-bundle
Applications that don't use Symfony Flex
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require roadiz/solr-bundle
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the config/bundles.php
file of your project:
// config/bundles.php return [ // ... \RZ\Roadiz\SolrBundle\RoadizSolrBundle::class => ['all' => true], ];
Configuration
DotEnv variables
###> nelmio/solarium-bundle ### SOLR_HOST=solr SOLR_PORT=8983 SOLR_PATH=/ SOLR_CORE_NAME=roadiz SOLR_COLLECTION_NUM_SHARDS=1 SOLR_COLLECTION_REPLICATION_FACTOR=1 ###< nelmio/solarium-bundle ###
Solarium config
Update nelmio/solarium-bundle
default config
# config/packages/nelmio_solarium.yaml nelmio_solarium: endpoints: default: # We use Solr Cloud with collection host: '%env(SOLR_HOST)%' port: '%env(int:SOLR_PORT)%' path: '%env(SOLR_PATH)%' core: '%env(SOLR_CORE_NAME)%' clients: default: endpoints: [default] # You can customize the http timeout (in seconds) here. The default is 5sec. adapter_timeout: 5
Api Resources
Add api_nodes_sources_search
API operation to expose NodesSourcesSearchController
# config/api_resources/nodes_sources.yml resources: RZ\Roadiz\CoreBundle\Entity\NodesSources: operations: api_nodes_sources_search: class: ApiPlatform\Metadata\GetCollection method: 'GET' uriTemplate: '/nodes_sources/search' controller: RZ\Roadiz\SolrBundle\Controller\NodesSourcesSearchController read: false normalizationContext: groups: - get - nodes_sources_base - nodes_sources_default - urls - tag_base - translation_base - document_display openapiContext: summary: Search NodesSources resources description: | Search all website NodesSources resources using **Solr** full-text search engine parameters: - type: string name: search in: query required: true description: Search pattern schema: type: string
Monolog
Add a solr handler to your monolog config if you want to separate its logs in a different file.
# config/packages/monolog.yaml monolog: handlers: solr: type: stream path: "%kernel.logs_dir%/solr.%kernel.environment%.log" level: debug channels: ["searchEngine"]
Crontab
You can add a crontab entry to reindex all your website content every day at midnight:
0 0 * * * /usr/local/bin/php -d memory_limit=-1 /app/bin/console solr:reindex --no-debug -n -q
Contributing
Report issues and send Pull Requests in the main Roadiz repository