code711 / solrtools

一组用于管理多站设置的Solr索引的CLI工具

安装次数:2,460

依赖项: 0

建议者: 0

安全: 0

星星: 1

关注者: 1

分支: 0

开放问题: 0

类型:typo3-cms-extension

2.0.3 2024-07-14 14:10 UTC

This package is auto-updated.

Last update: 2024-09-14 14:31:28 UTC


README

Latest Stable Version TYPO3 12 Total Downloads Monthly Downloads PHPSTAN:Level 9 build:passing Psalm coverage

此扩展提供CLI工具,从命令行初始化EXT:solr索引队列,并扫描内容中的文件引用以将相应的站点添加到使用文件的sys_file元数据中。

这些工具针对具有多个站点的安装。它们不会执行在TYPO3后端无法执行的操作,但可能节省一些时间,或者在特定的CI/CD情况下可能很有用。

此外,还提供了一个SolrEntityInterface,用于Extbase模型在通过Extbase在前端更改记录时更新solr索引(类似于EXT:slug_extbase)。

变更日志

2.0.1

  • 支持TYPO3 v11-v12
  • SolrfilemetaCommand.php不再为隐藏页面或具有受限FE用户访问权限的页面上的文件设置'enable_indexing'

2.0.0

  • 支持TYPO3 v11-v12
  • SolrfilemetaCommand.php不再为隐藏页面或具有受限FE用户访问权限的页面上的文件设置'enable_indexing'

1.2.0

  • 更好地处理未配置solr的站点
  • 添加了使用选项-w/--what中的关键字'所有'来为站点中配置的所有表创建索引的可能性

1.1.1

  • 更好的事件标识符

1.1.0

  • 添加了Code711\SolrTools\Interfaces\SolrEntityInterface以启用Extbase模型在通过extbase持久化时更新其索引

1.0.2

  • 添加了承诺但缺失的tt_content:header_link中的文件引用扫描

1.0.1

  • 更新TER描述

1.0.0

  • 初始版本

Code711\SolrTools\Interfaces\SolrEntityInterface

要为您的模型启用此功能,只需将其添加到模型类的定义中,例如

class MyModel extends TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements \Code711\SolrTools\Interfaces\SolrEntityInterface

现在在持久化此类对象时,它将检查它是否已在solr中索引,如果是,则其索引将通过正常调度程序过程添加或更新。接口本身没有其他要求,仅用作标识符以识别要关注的模型。

solr:tools:createindex

./vendor/bin/typo3 solr:tools:createindex --help

Description:
  This tool creates (re)index tasks for solr per table and site or all sites

Usage:
  solr:tools:createindex [options] [--] ...

Arguments:
  site                  Site identifier or ALL for all sites

Options:
  -w, --what=WHAT       what to index (eq pages) (multiple values allowed). Enter "all" to index all configured pages
  -c, --cleanup         clean the solr index per site
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

此工具假定EXT:solr已在TYPO3中设置和配置。

示例

这将创建所有站点的表pages的索引任务,并在运行清理之前执行

./vendor/bin/typo3 solr:tools:createindex -w pages --cleanup ALL

这将创建标识符为customer1和customer3的站点的表tx_news和sys_file_metadata的索引任务

./vendor/bin/typo3 solr:tools:createindex -w tx_news -w sys_file_metadata customer1 customer3

下面的代码将为所有站点的所有表创建索引任务

./vendor/bin/typo3 solr:tools:createindex -w all all

solr:tools:filemeta

此工具将在文件引用表和header_link以及bodytext字段中搜索与给定文件扩展名匹配的文件。然后它将根据与记录关联的页面ID查找相应的站点,并将该站点ID添加到由EXT:solr_file_indexer提供的enable_indexing字段中。

该工具将检查元素是否可见(deleted=0,hidden=0)以及页面及其父页面是否可见,以确保仅将“活动”文件添加到solr索引中。

./vendor/bin/typo3 solr:tools:filemeta --help

Description:
This tool searches for relations of files in the database and adds the correct site reference in the Files metadata, in order for EXT:solr to index those files correctly

Usage:
solr:tools:filemeta [options]

Options:
      --ext[=EXT]       File extensions to allow [default: ["doc","docx","pdf"]] (multiple values allowed)
  -c, --cleanup         clean the site field in all meta data
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug