From 47d55f33892cde143f8f0dfacd887289f73582c2 Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 12 Mar 2020 10:17:02 +0800 Subject: [PATCH] (Docs module)Full-Text Search(Elastic Search) --- docs/en/Modules/Docs.md | 26 ++++++++++++++++++++++++++ docs/zh-Hans/Modules/Docs.md | 24 ++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/docs/en/Modules/Docs.md b/docs/en/Modules/Docs.md index 0c0a221569..db752ceb74 100644 --- a/docs/en/Modules/Docs.md +++ b/docs/en/Modules/Docs.md @@ -572,6 +572,32 @@ The upper sample `JSON` file renders the below navigation menu as `HTML`. Finally a new Docs Module is added to your project which is feeded with GitHub. + +## Full-Text Search(Elastic Search) + +The Docs module supports full-text search using Elastic Search. It is not enabled by default. You can configure `DocsElasticSearchOptions` to enable it. + +``` +Configure(options => +{ + options.Enable = true; + options.IndexName = "your_index_name"; //default IndexName is abp_documents +}); +``` + +The `Index` is automatically created after the application starts if the `Index` does not exist. + +`DefaultElasticClientProvider` is responsible for creating `IElasticClient`. By default, it reads Elastic Search's `Url` from `IConfiguration`. +If your `IElasticClient` needs additional configuration, please use override `IElasticClientProvider` service and replace it in the [dependency injection](Dependency-Injection.md) system. + +``` +{ + "ElasticSearch": { + "Url": "http://localhost:9200" + } +} +``` + ## Next Docs Module is also available as a standalone application. Check out [VoloDocs](../Apps/VoloDocs). \ No newline at end of file diff --git a/docs/zh-Hans/Modules/Docs.md b/docs/zh-Hans/Modules/Docs.md index a339730f49..20382d24f2 100644 --- a/docs/zh-Hans/Modules/Docs.md +++ b/docs/zh-Hans/Modules/Docs.md @@ -572,6 +572,30 @@ This document assumes that you prefer to use **{{ UI_Value }}** as the UI framew 最后,为您的项目添加了一个新的Docs模块, 该模块由GitHub提供. +## 全文搜索(Elastic Search) + +文档模块支持使用Elastic Search对内容进行全文搜索. 默认没有启用, 你可以配置`DocsElasticSearchOptions`启用它. + +``` +Configure(options => +{ + options.Enable = true; + options.IndexName = "your_index_name"; //default IndexName is abp_documents +}); +``` + +应用程序启动后如果`Index`不存在则会自动创建`Index`. + +`DefaultElasticClientProvider`负责创建`IElasticClient`, 默认情况下它会从`IConfiguration`中读取Elastic Search的`Url`. +如果你的IElasticClient需要其它配置请使用重写IElasticClientProvider服务并在依赖注入系统中替换它. +``` +{ + "ElasticSearch": { + "Url": "http://localhost:9200" + } +} +``` + ## 下一步 文档模块也可以做为独立的应用程序. 查看 [VoloDocs](../Apps/VoloDocs). \ No newline at end of file