reliefweb / api-indexer
Standalone library to index the RW database into the API elasticsearch indexes.
Installs: 2 797
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 6
Forks: 0
Open Issues: 1
Requires
- php: >=8.0
- league/commonmark: ^2.2
Requires (Dev)
- drupal/coder: ^8.3
- phpunit/phpunit: ^9.5
- dev-main
- v2.x-dev
- v2.8.0
- v2.7.0
- v2.6.2
- v2.6.1
- v2.6.0
- v2.5.0
- v2.5.0-alpha
- v2.4.0
- v2.3.1
- v2.3.0
- v2.2.5
- v2.2.4
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.1
- v2.1.0
- v2.0.2
- v2.0.1
- v2.0.0
- v1.x-dev
- v1.20.0
- v1.19.0
- v1.18.0
- v1.17.2
- v1.17.1
- v1.17.0
- v1.16.0
- v1.15.0
- v1.14.0
- v1.13.0
- v1.12.0
- v1.11.0
- v1.10.0
- v1.9.1
- v1.9.0
- v1.8.0
- v1.7.0
- v1.6.0
- v1.5.0
- v1.4.1
- v1.4.0
- v1.3.1
- v1.3.0
- v1.2.0
- v1.1.0
- v1.0.0
- dev-RW-867
- dev-RW-742
- dev-RW-699
- dev-RW-653
- dev-RW-627
- dev-RW-594
- dev-RW-610
- dev-RW-457
- dev-RW-474
- dev-RW-437
- dev-OPS-8033
- dev-feature/simulate
- dev-RW-317
- dev-RW-251
- dev-master
- dev-andy/zFvX3Kct-add-unit-tests
- dev-test/indexing-performance
This package is auto-updated.
Last update: 2024-11-12 06:58:47 UTC
README
Standalone application to index the content of the RW database into the API elasticsearch indexes without Drupal.
Command line
Usage: php PATH/TO/Indexer.php [options] <entity-bundle>
-h, --help display this help
-e, --elasticsearch <arg> Elasticsearch URL, defaults to http://127.0.0.1:9200
-H, --mysql-host <arg> Mysql host, defaults to localhost
-P, --mysql-port <arg> Mysql port, defaults to 3306
-u, --mysql-user <arg> Mysql user, defaults to root
-p, --mysql-pass <arg> Mysql pass, defaults to none
-d, --database <arg> Database name, deaults to reliefwebint_0
-b, --base-index-name <arg> Base index name, deaults to reliefwebint_0
-t, --tag <arg> Tag appended to the index name, defaults to empty string
-w, --website <arg> Website URL, deaults to https://reliefweb.int
-l, --limit <arg> Maximum number of entities to index, defaults to 0 (all)
-o, --offset <arg> ID of the entity from which to start the indexing, defaults to the most recent one
-f, --filter <arg> Filter documents to index. Format: 'field1:value1,value2+field2:value1,value2'
-c, --chunk-size <arg> Number of entities to index at one time, defaults to 500
-i, --id Id of an entity item to index, defaults to 0 (none)
-r, --remove Removes an entity if 'id' is provided or the index for the given entity bundle
-a, --alias Set up the alias for the index after the indexing, ignored if id is provided
-A, --alias-only Set up the alias for the index without indexing, ignored if id is provided
Library
Add the library with composer:
composer require "reliefweb/api-indexer"
And then create a new Manager, providing an options array (see above for the options using their fullname):
use RWAPIIndexer\Manager; // Indexing options to index all reports. $options = array( 'bundle' => 'report', 'elasticsearch' => 'http://127.0.0.1:9200', 'mysql-host' => 'localhost', 'mysql-port' => 3306, 'mysql-user' => 'root', 'mysql-pass' => '', 'database' => 'DATABASE_NAME', 'base-index-name' => 'ELASTICSEARCH_INDEX_PREFIX', 'tag' => '', 'website' => 'https://reliefweb.int', 'limit' => 0, 'offset' => 0, 'chunk-size' => 500, 'id' => 0, 'remove' => FALSE, 'alias' => TRUE, ); // Create the indexing manager. $manager = new Manager($options); // Index or delete based on the provided options. $manager->execute();
Markdown
It's recommended to have php-hoedown installed. If not, the indexer will default to the PHP League CommonMark library which is slower.