helsingborg-stad / algolia-index
将wordpress网站内容索引到algolia。
3.1.8
2024-09-16 09:13 UTC
Requires
Requires (Dev)
- php-stubs/wordpress-tests-stubs: ^6.1
- phpunit/phpunit: ^9.6
- yoast/phpunit-polyfills: ^1.0
- dev-master
- dev-main
- 3.1.8
- 3.1.7
- 3.1.6
- 3.1.5
- 3.1.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.9
- 3.0.8
- 3.0.7
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 2.0.0
- 1.9.4
- 1.9.3
- 1.9.2
- 1.9.1
- 1.9.0
- 1.8.11
- 1.8.10
- 1.8.9
- 1.8.8
- 1.8.7
- 1.8.6
- 1.8.5
- 1.8.4
- 1.8.3
- 1.8.2
- 1.8.1
- 1.8.0
- 1.7.4
- 1.7.3
- 1.7.2
- 1.7.1
- 1.7.0
- 1.6.0
- 1.5.0
- 1.4.0
- 1.3.0
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.0
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-webpack-fix
- dev-fix/malformed-utf8-esape
- dev-fix/indexing-image-size
- dev-perf/wp_post_vs_id
- dev-feature/remove-short-codes-from-content
- dev-feature/index-custom-taxonomies
- dev-fix/guzzlehttp-package-security
- dev-fix/algolia-global-post-missing-CU-865c7g7c0
- dev-feature/test
- dev-feature/gutenberg-excerpt
- dev-3.0/feat-php-update
- dev-feature/remove-non-published
- dev-fix/Image-quality
This package is auto-updated.
Last update: 2024-09-16 09:46:38 UTC
README
管理algolia索引(具有ms支持和混合索引)。此插件旨在由开发人员使用。此插件提供以下功能集
- 用algolia替换前端上的algolia搜索。
- 在文章更新或创建时索引所有公共可搜索的文章。
- 使用WpCLI作业批量索引网站上的所有文章。
- 支持混合索引(同一索引中的多个wordpress站点)。
- 大记录分割(内容字段)。
- 在查询algolia之前执行“需要更新”检查,以节省昂贵的更新。此功能不适用于分割记录。
安装
- 使用: "composer require helsingborg-stad/algolia-index" 安装
- 在插件内部运行composer install
- 添加必要的常量定义。
- 运行wp-cli作业 "wp algolia-index build"
常量
- define('ALGOLIAINDEX_APPLICATION_ID', 'ALGOLIAAPPID'); - 必需
- define('ALGOLIAINDEX_API_KEY', 'ALGOLIAAPIKEY'); - 必需
- define('ALGOLIAINDEX_INDEX_NAME', 'INDEX'); - 可选
- define('ALGOLIAINDEX_PUBLIC_API_KEY', 'INDEX'); - 可选,由js搜索页面插件要求
过滤器
- AlgoliaIndex/ShouldIndex: 向应索引函数添加更多规则(不可删除)。
- AlgoliaIndex/Record: 向algolia发送哪些数据。
- AlgoliaIndex/Compare: 比较哪些字段以确定文章是否已更新。
- AlgoliaIndex/SearchableAttributes: 记录中哪些属性可搜索。
- AlgoliaIndex/GeneratedIndexName: 过滤自动生成的索引名称。
- AlgoliaIndex/RecordToLarge: 通过返回false关闭记录过大报告。用于禁用记录分割。仅兼容企业计划,不推荐!
- AlgoliaIndex/IndexablePostTypes: 要索引哪些文章类型。
- AlgoliaIndex/HitsPerPage: 每页的命中数。
- AlgoliaIndex/AttributesToSnippet: 要片段的属性。
- AlgoliaIndex/SnippetEllipsisText: 片段的后缀。
- AlgoliaIndex/BackendSearchActive: 发送false以禁用后端搜索。
- AlgoliaIndex/IndexablePostStatuses: 允许索引哪些文章状态。
操作
- AlgoliaIndex/IndexPostId: 触发特定文章ID的重新索引。
- AlgoliaIndex/SendSettings: 发送设置。
WP CLI
- wp algolia-index build: 索引网站上的所有页面/文章。
WP CLI参数
- 在构建前清除index*,请添加标志 --clearindex=true。
- 在构建前发送所需的搜索配置,请添加标志 --settings=true。
示例
wp site list --field=url --public=1 --archived=0 --deleted=0 --allow-root | xargs -n1 -I % wp algolia-index build --settings=true --url=% --allow-root
- 此操作与一个共享索引中的多个站点不完全兼容!共享同一索引的站点将被清除但不会重新索引。