humanmade/elasticpress-stopwords

WordPress 插件,用于将 WordPress 的停用词与 ElasticPress 映射集成。

安装量: 2,770

依赖项: 0

建议者: 0

安全: 0

星标: 4

关注者: 21

分支: 1

开放问题: 1

类型:wordpress-plugin

dev-main 2021-01-22 21:26 UTC

This package is auto-updated.

Last update: 2024-09-23 06:06:24 UTC


README

ElasticPress 停用词插件允许开发者通过将 ElasticPress 映射与 WordPress 默认停用词列表相关联,并使用相关过滤器 wp_search_stopwords 来自定义 Elastic 的停用词功能。

需求

  • PHP >= 7.1
  • WordPress >= 5.3
  • ElasticPress >= 3.4.3 (未在旧版本上测试)

设置环境

使用 Composer 安装

composer require humanmade/elasticpress-stopwords

加载插件

require_once __DIR__ . '/vendor/humanmmade/elastic-stopwords/plugin.php';

安装插件后,请使用以下代码管理停用词

add_filter( 'wp_search_stopwords', function( array $stopwords ) : array {
    $words_to_remove = [ 'foo' ];
    $words_to_add    = [ 'bar' ];
    return array_merge( array_diff( $stopwords, $words_to_remove ), $words_to_add );
} );

致谢

由 Human Made 用 ❤️ 创建

Shady Sharaf 编写和维护。

想要加入这个有趣的团队? 加入我们,成为人类的一员!