thoughtco/zinc-search
Composer 安装命令:
composer require thoughtco/zinc-search
包简介
README 文档
README
ZincSearch is a Statamic addon to speed up your listing views in the control by using the power of ZincSearch.
Features
This addon makes your control panel listings go super-dooper-fast.
How to Install
Ensure you have a working ZincSearch installation.
Run the following command from your project root:
composer require thoughtco/zinc-search
Add the zincsearch driver to the drivers array in config/statamic/search.php:
'zincsearch' => [ 'credentials' => [ 'url' => env('ZINCSEARCH_URL', ''), 'username' => env('ZINCSEARCH_USERNAME', ''), 'password' => env('ZINCSEARCH_PASSWORD', ''), ], ],
Add the variables to your .env file for ZINCSEARCH_URL, ZINCSEARCH_USERNAME and ZINCSEARCH_PASSWORD.
How to Use
Set up a search index for the collection e.g.
'pages' => [ 'driver' => 'zincsearch', 'searchables' => ['collection:pages'], 'fields' => ['id', 'title', 'url', 'content', 'status'], 'searchable_fields' => ['title, 'slug'], 'settings' => [], ],
Then apply this to your collection YAML definition with a key of search_index e.g.
title: Pages revisions: false title_format: null sort_by: title sort_dir: asc preview_targets: - label: Entry url: '{permalink}' structure: root: true search_index: pages
Antlers / Front end
To make use of this use the speed of this search in your front end, use the search_index tag instead of collection.
e.g.
{{ search:results index="pages" supplement_data="false" for="*" as="results" limit="10" offset="0" paginate="10" }}
{{ if no_results }}
No results
{{ else }}
{{ results }}
<p>{{ id }} - {{ title }}</p>
{{ /results }}
{{ /if }}
{{ /search:results }}
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2023-06-16