@10up/frontity-elasticpress 中文文档教程

发布于 3年前 浏览 23 项目主页 更新于 3年前

@10up/frontity-elasticpress

该软件包通过增强 ElasticPress 的搜索体验来增强您的前端主题。

支持级别

Requirements

Installation

要安装这个包,您需要一个现有的 frontity 项目。 查看 frontity 文档 以获取说明。

安装此包:

npm install @10up/frontity-elasticpress --save

然后在 frontitiy.settings.[js|ts]packages 部分添加 ElasticPress 的配置。

        {
            name: '@10up/frontity-elasticpress',
            state: {
                elasticpress: {
                    node: 'http://elasticpress.test/__elasticsearch',
                    indexName: 'elasticpresstest-post-1',
                    loadInitialData: true,
                },
            },
        },

这就是你所需要的。

How it works

该软件包将默认搜索处理程序替换为自定义搜索处理程序,该处理程序直接在 ElasticSearch 索引中而不是 WordPress 中运行搜索查询。

除了更好的搜索结果之外,这还允许您在键入时获得实时搜索结果。 请在此处查看示例.

Disclaimer

您需要确保您的 ElasticSearch 索引没有完全暴露给公众。 您很可能希望在 ElasticSearch 索引周围添加一些层来锁定索引以避免不需要的查询或请求。

查看 ElasticPress.io,了解为 ElasticPress 构建的安全 ElasticSearch 服务。

Like what you see?

10up 时与我们一起工作

@10up/frontity-elasticpress

This package enhances your frontity theme by supercharing the search experience with ElasticPress.

Support Level

Requirements

Installation

To install this package you will need an existing frontity project. Check out the frontity docs for instructions.

Install this package:

npm install @10up/frontity-elasticpress --save

Then in your frontitiy.settings.[js|ts] add the configuration for ElasticPress in the packages section.

        {
            name: '@10up/frontity-elasticpress',
            state: {
                elasticpress: {
                    node: 'http://elasticpress.test/__elasticsearch',
                    indexName: 'elasticpresstest-post-1',
                    loadInitialData: true,
                },
            },
        },

That's all you need.

How it works

This packages replaces the default search handler with a custom one that runs search queries in ElasticSearch index directly instead of WordPress.

In addition to better search results this also allow you to have real-time search results as you type. See an example here.

Disclaimer

You need to ensure your ElasticSearch index is not fully exposed to the public. You most likely want to add some layer around your ElasticSearch index to lock down your index to avoid unwanted queries or requests.

Check out ElasticPress.io for a secure ElasticSearch service that was built for ElasticPress.

Like what you see?

Work with us at 10up

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文