承接 reliefweb/api-indexer 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

reliefweb/api-indexer

最新稳定版本:v2.10.0

Composer 安装命令:

composer require reliefweb/api-indexer

包简介

Standalone library to index the RW database into the API elasticsearch indexes.

README 文档

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.

统计信息

  • 总下载量: 5.43k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2022-06-10