silverstripe/silverstripe-search-sdk
Composer 安装命令:
composer require silverstripe/silverstripe-search-sdk
包简介
A Software Development Kit for Silverstripe Search
关键字:
README 文档
README
Silverstripe Search is designed to integrate easily with the Silverstripe CMS. This Software Development Kit (SDK) is a one-stop-shop for getting your application integrated.
Tagged dependencies
As part of the Silverstripe Search managed service, we will put the required dependencies (and the explicit versions) through our internal regression testing before adding them to this SDK.
This means that new tags for the SDK will trail tags being made on the upstream dependencies to ensure they are stable and work well with the service.
If you want updates to dependencies faster, then you should define your own requirements for those dependencies with your own version constraints. By doing so, you accept the risks of your defined versioned constraints.
Engine vs Index
Important
TL;DR:
For all intents and purposes, "engine" and "index" are synonomous. If we refer to something as "engine", but the Discoverer module is asking for an "index", then you simply need to give it the data you have for your engine.
The Discoverer and Forager modules are built to be service-agnostic; meaning, you can use them with any search provider, as long as there is an adaptor for that service.
When Discoverer refers to an "index", it is talking about the data store used for housing your content. These data stores are known by different names across different search providers. Algolia and Elasticsearch call them "indexes", Typesense calls them "collections", App Search calls them "engines". Discoverer had to call them something in its code, and it chose to call then "indexes"; Silverstripe Search, however, calls them "engines".
Actions apply in the same way to all of the above. In Silverstripe Search, the action of "indexing" is the action of adding data to your engine, where it is said to be "indexed". Updating that data is commonly referred to as "re-indexing".
Setting up
Before you can get stared with this SDK you will need:
- A Silverstripe CMS application
- Bifröst Environment variables (provided when you sign up for Silverstripe Search)
Installation
There are 3 core parts to the SDK:
- Indexing: Getting your CMS content indexed into the search engine
- Provided by the Forager module
- Querying: Searching the indexed content in your search engine
- Provided by the Discoverer module
- Search UI: A default implementation of a search results page with basic control over search options, designed to get you up and running quickly if you have basic search requirements
- Provided by the Discoverer > Search UI module
1. Indexing, and 2. Querying are likely to be requirements for most projects, but 3. Search UI potentially isn't. Some reasons why you might not want the Search UI include:
- You are using Subsites
- You are using Fluent
- You perform your search queries through JavaScript/XHR
- You have other complex search requirements that aren't covered by the Search UI module
Install the complete SDK run:
composer require silverstripe/silverstripe-search-sdk
Updates
To update the SDK, be sure to include -W / --with-all-dependencies
composer update silverstripe/silverstripe-search-sdk -W
🛼 Roll-your-own installation
If you want to dial in your installation you can manually add the packages above to your composer.json.
- If you only want 1. Indexing, then you could require just the Forager dependencies
- If you only want 2. Querying, then you could require just the Discoverer dependencies
It will be up to you what version constraints you apply, but noting again, only the versions required in this repository have gone through our regression testing process.
Specify environment variables
To integrate with Silverstripe Search, define environment variables containing your endpoint, engine prefix, management API key, and query API key.
BIFROST_ENDPOINT=<< provided on sign up >>
BIFROST_ENGINE_PREFIX=<< provided on sign up >>
BIFROST_MANAGEMENT_API_KEY=<< provided on sign up >>
BIFROST_QUERY_API_KEY=<< provided on sign up >>
Tip
For Silverstripe Cloud clients:
BIFROST_ENDPOINTandBIFROST_ENGINE_PREFIXshould be added as VariablesBIFROST_MANAGEMENT_API_KEYandBIFROST_QUERY_API_KEYshould be added as Secrets.
Understanding your engine prefix and suffix:
- All Silverstripe Search engine names follow a 4 slug format like this:
search-<subscription>-<environment>-<suffix> - Your
<engine-prefix>is everything except-<suffix>; so, it's justsearch-<subscription>-<environment>
For example:
| Engine | Engine prefix | Engine suffix |
|---|---|---|
| search-acmecorp-prod-main | search-acmecorp-prod | main |
| search-acmecorp-prod-inc | search-acmecorp-prod | inc |
| search-acmecorp-uat-main | search-acmecorp-uat | main |
| search-acmecorp-uat-inc | search-acmecorp-uat | inc |
Why?
Because you probably have more than one environment type that you're running search on (e.g. Production and UAT), and (generally speaking) you should have different engines for each of those environments. So, you can't just hardcode the entire engine name into your project, because that code doesn't change between environments.
Whenever you make a query, Forager and Discoverer will ask you for the "index" name; you will actually want to provide only the <suffix>. We will then take BIFROST_ENGINE_PREFIX and your <suffix>, put them together, and that's what will be queried. This allows you to set BIFROST_ENGINE_PREFIX differently for each environment, while having your <suffix> hardcoded in your project.
Indexing your CMS content
Please see the Forager > Bifröst documentation for details on how to get set up with indexing your content.
Get search to your users
You may or may not want to use the Discoverer > Search UI module, if you don't want to use it, then the Discoverer module has quite a bit of documentation regarding how you can get your search form and results in front of your users; including an example SearchResults Page and Controller:
- Discoverer > Bifröst documentation for details on how to start querying the indexed content from your engines.
- Simple usage: An example
SearchResultsPage, Controller, and template, with a basic query example with pagination and result fields - Detailed querying: How to query with filters, search fields, result fields, facets, etc
- Detailed result handling: More information about the
Resultsobject that Discoverer returns to you whenever you perform a search query
Administrative interface
The Silverstripe Search Dashboard provides an interface for managing feature such as Synonyms, Curations, Analytics and Relevancy Tuning. Refer to the User documentation for more information
silverstripe/silverstripe-search-sdk 适用场景与选型建议
silverstripe/silverstripe-search-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.17k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 07 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「search」 「silverstripe」 「Development Kit」 「Silverstripe CMS」 「Search Service」 「Search Service SDK」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 silverstripe/silverstripe-search-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 silverstripe/silverstripe-search-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 silverstripe/silverstripe-search-sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel package to retrieve data from Google Search Console
Debugging a problem and need to login as one of your customers? This allows you to authenticate as any of your customers.
Indexed Search Autocomplete - Extends the TYPO3 Core Extension Indexed_Search searchform with an autocomplete feature.
Abstraction Layer to index and search entities
Library with classes to help you do batch.
统计信息
- 总下载量: 1.17k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2024-07-31