Skip to content

Commit

Permalink
Attempt to split Elastic support into separate module
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispenny committed Mar 5, 2023
1 parent 87cd01e commit 9febb90
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 2,587 deletions.
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
[![Version](http://img.shields.io/packagist/v/silverstripe/silverstripe-search-service.svg?style=flat-square)](https://packagist.org/packages/silverstripe/silverstripe-search-service)
[![License](http://img.shields.io/packagist/l/silverstripe/silverstripe-search-service.svg?style=flat-square)](LICENSE)

This module for Silverstripe CMS provides a set of abstraction layers that integrate the
CMS with a search-as-a-service provider, such as Elastic or Algolia. Out of the box, it
supports indexing DataObjects with Elastic EnterpriseSearch, but can be extended to work with
other sources of content and/or service providers.
This module for Silverstripe CMS provides a set of abstraction layers that integrate the CMS with a search-as-a-service
provider, such as Elastic or Algolia.

This module does not provide any frontend functionality such as UI or querying APIs.
It only handles indexing.
Note this module does not provide:

* Specific service integrations. See [Available service integration modules](available-service-integration-modules.md).
* Any frontend functionality such as UI or querying APIs. It only handles indexing.

## Installation

Expand All @@ -21,11 +21,9 @@ composer require "silverstripe/silverstripe-search-service"

## Requirements

* php: ^8.0
* guzzlehttp/guzzle: ^7
* symbiote/silverstripe-queuedjobs: ^4
* elastic/enterprise-search: ^8.3
* silverstripe/versioned: ^1
* php: ^8.1
* silverstripe/cms: ^5
* symbiote/silverstripe-queuedjobs: ^5

## Documentation

Expand Down
30 changes: 0 additions & 30 deletions _config/enterprisesearch.yml

This file was deleted.

6 changes: 2 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
],
"require": {
"php": "^8.1",
"guzzlehttp/guzzle": "^7",
"silverstripe/cms": "^5",
"symbiote/silverstripe-queuedjobs": "^5",
"elastic/enterprise-search": "^8.6"
"symbiote/silverstripe-queuedjobs": "^5"
},
"require-dev": {
"silverstripe/recipe-testing": "^3",
"slevomat/coding-standard": "^8.8",
"slevomat/coding-standard": "~8.8.0",
"silverstripe/subsites": "^3"
},
"autoload": {
Expand Down
3 changes: 3 additions & 0 deletions docs/en/available-service-integration-modules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Available service integration modules

* [Silverstripe Search Service > Elastic](https://github.com/silverstripe/silverstripe-search-service-elastic)
104 changes: 0 additions & 104 deletions docs/en/changes-in-v2.md

This file was deleted.

12 changes: 12 additions & 0 deletions docs/en/changes-in-v3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Breaking changes in `3.0.0`

Support for Elastic Enterprise Search is now supplied through
[Silverstripe Search Service - Elastic](https://github.com/silverstripe/silverstripe-search-service-elastic).

This was (moreorless) just a lift and shift. There were namespace and linting changes, but otherwise there should be
no breaking changes between the experience you had in version `2` of Silverstripe Search Service, and what you now
have in version `3` with the addition of version `1` of Silverstripe Search Service - Elastic.

```bash
composer require silverstripe/silverstripe-search-service-elastic
```
2 changes: 1 addition & 1 deletion docs/en/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ SilverStripe\SearchService\Service\PageCrawler:
## Subsites
Due to the way that filtering works with Elastic App Search, you may want to split
Due to the way that filtering works with (eg) Elastic Enterprise Search, you may want to split
each subsite's content into a separate engine. To do so, you can use the following
configuration:
Expand Down
6 changes: 2 additions & 4 deletions docs/en/customising.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Customising and Extending

The goal of this module is to provide a set of useful abstraction layers upon which developers
can build search-as-a-service integrations that best suit their needs. Out of the box, it
includes concretions for Elastic EnterpriseSearch and DataObject content, but this can be extended.
This section of the document covers the customisation and extension of those abstraction
layers.
can build search-as-a-service integrations that best suit their needs. This section of the document covers the
customisation and extension of those abstraction layers.

## Contents

Expand Down
44 changes: 2 additions & 42 deletions docs/en/implementations.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,9 @@ This is the service that is enabled by default. It does not interact with any sp
there to fill the whole in the abstraction layer when search is not yet being used. It is also a good option
to have enabled when running tests and/or doing CI builds.

## Elastic EnterpriseSearch
## Available service integration modules

This module comes bundled with an implementation for [Elastic EnterpriseSearch](https://www.elastic.co/app-search/).
While most of the details are abstracted away in the `EnterpriseSearchService` class, there are some key things to
know about configuring EnterpriseSearch.

### Activating EnterpriseSearch

To start using EnterpriseSearch, simply define an environment variable containing your private API key
and endpoint.

```
ENTERPRISE_SEARCH_ENDPOINT="https://abc123.app-search.ap-southeast-2.aws.found.io"
ENTERPRISE_SEARCH_API_KEY="private-abc123"
```

### Configuring EnterpriseSearch

The most notable configuration surface for EnterpriseSearch is the schema, which determines how data
is stored in your EnterpriseSearch index (engine). There are four types of data in EnterpriseSearch:

* Text (default)
* Date
* Number
* Geolocation

You can specify these data types in the `options` node of your fields.

```yaml
SilverStripe\SearchService\Service\IndexConfiguration:
indexes:
myindex:
includeClasses:
SilverStripe\CMS\Model\SiteTree:
fields:
title:
property: Title
options:
type: text
```
**Note**: Be careful about whimsically changing your schema. EnterpriseSearch may need to be fully
reindexed if you change the data type of a field.
[Available service integration modules](available-service-integration-modules.md)

## More information

Expand Down
2 changes: 1 addition & 1 deletion docs/en/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* [Configuring the search service](usage.md#configuring-the-search-service)
* [Dependency tracking](usage.md#dependency-tracking)
* [Implementations](implementations.md)
* [EnterpriseSearch](implementations.md#EnterpriseSearch)
* [Available service integration modules](available-service-integration-modules.md)
* [Customising and extending](customising.md)
* [Adding a new search service](customising_add_search_service.md)
* [The IndexingInterface specification](customising_add_search_service.md#the-indexinginterface-specification)
Expand Down
27 changes: 13 additions & 14 deletions docs/en/overview.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
# Overview and rationale

This module provides a set of abstraction layers that integrate the Silverstripe CMS content
with a search-as-a-service provider, such as [Elastic](https://elastic.co) or [Algolia](https://algolia.com). The focus of this module
is on indexing content only. It does not provide any frontend tooling for UI nor APIs for
querying data.

## Defaults

Out of the box, an implementation is included for indexing DataObject based content
with [Elastic EnterpriseSearch](https://www.elastic.co/app-search/). ([More about the EnterpriseSearch implementation](implementations.md#EnterpriseSearch))
with a search-as-a-service provider, such as [Elastic](https://elastic.co) or [Algolia](https://algolia.com). The focus
of this module is on indexing content only. It does not provide any frontend tooling for UI nor APIs for querying data.

## Extending

Additional search-as-a-service integrations can be added using the `IndexInterface` abstraction.
Additional non-dataobject content types can also be exposed to indexes. They must be class-backed
and implement the `DocumentInterface` abstraction.
Additional search-as-a-service integrations can be added using the `IndexInterface` abstraction. Additional
non-dataobject content types can also be exposed to indexes. They must be class-backed and implement the
`DocumentInterface` abstraction.

## Indexing workflow

Indexing can be very resource intensive, and as such, using [QueuedJobs](https://github.com/symbiote/silverstripe-queuedjobs) is required. Understanding that running asynchronous tasks can be cumbersome
in dev mode, there is a `use_sync_jobs` [configuration setting](configuration.md) that runs the jobs
synchronously, but this is not recommended for production.
Indexing can be very resource intensive, and as such, using
[QueuedJobs](https://github.com/symbiote/silverstripe-queuedjobs) is required. Understanding that running asynchronous
tasks can be cumbersome in dev mode, there is a `use_sync_jobs` [configuration setting](configuration.md) that runs the
jobs synchronously, but this is not recommended for production.

## Available service integration modules

[Available service integration modules](available-service-integration-modules.md)

## More information

Expand Down
2 changes: 1 addition & 1 deletion src/Admin/SearchAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
use SilverStripe\SearchService\Jobs\IndexJob;
use SilverStripe\SearchService\Jobs\ReindexJob;
use SilverStripe\SearchService\Jobs\RemoveDataObjectJob;
use SilverStripe\SearchService\Service\EnterpriseSearch\EnterpriseSearchService;
use SilverStripe\SearchService\Tasks\SearchReindex;
use SilverStripe\SearchServiceElastic\Service\EnterpriseSearchService;
use SilverStripe\Security\Permission;
use SilverStripe\Security\PermissionProvider;
use Symbiote\QueuedJobs\DataObjects\QueuedJobDescriptor;
Expand Down
45 changes: 0 additions & 45 deletions src/Service/EnterpriseSearch/ClientFactory.php

This file was deleted.

Loading

0 comments on commit 9febb90

Please sign in to comment.