mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 12:05:29 +00:00
NEW Allow autoconfigure to be disabled via configuration
This commit is contained in:
parent
c9a0fef326
commit
7a3e2d0823
@ -30,6 +30,20 @@ common interfaces to fulltext engine functionality, abstracting out common behav
|
|||||||
offers its own extensions, and there is some behaviour (such as getting the fulltext search engines installed, configured
|
offers its own extensions, and there is some behaviour (such as getting the fulltext search engines installed, configured
|
||||||
and running) that each connector deals with itself, in a way best suited to that search engine's design.
|
and running) that each connector deals with itself, in a way best suited to that search engine's design.
|
||||||
|
|
||||||
|
## Disabling automatic configuration
|
||||||
|
|
||||||
|
If you have this module installed but do not have a Solr server running, you can disable the database manipulation
|
||||||
|
hooks that trigger automatic index updates:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# File: mysite/_config/search.yml
|
||||||
|
---
|
||||||
|
Name: mysitesearch
|
||||||
|
---
|
||||||
|
SilverStripe\FullTextSearch\Search\Updaters\SearchUpdater:
|
||||||
|
enabled: false
|
||||||
|
```
|
||||||
|
|
||||||
## Basic usage
|
## Basic usage
|
||||||
|
|
||||||
Basic usage is a four step process:
|
Basic usage is a four step process:
|
||||||
|
@ -37,6 +37,14 @@ class SearchUpdater
|
|||||||
*/
|
*/
|
||||||
private static $flush_on_shutdown = true;
|
private static $flush_on_shutdown = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the updater is enabled. Set to false for local development if you don't have a Solr server.
|
||||||
|
*
|
||||||
|
* @config
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private static $enabled = true;
|
||||||
|
|
||||||
public static $registered = false;
|
public static $registered = false;
|
||||||
/** @var SearchUpdateProcessor */
|
/** @var SearchUpdateProcessor */
|
||||||
public static $processor = null;
|
public static $processor = null;
|
||||||
@ -53,6 +61,10 @@ class SearchUpdater
|
|||||||
*/
|
*/
|
||||||
public static function handle_manipulation($manipulation)
|
public static function handle_manipulation($manipulation)
|
||||||
{
|
{
|
||||||
|
if (!static::config()->get('enabled')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// First, extract any state that is in the manipulation itself
|
// First, extract any state that is in the manipulation itself
|
||||||
foreach ($manipulation as $table => $details) {
|
foreach ($manipulation as $table => $details) {
|
||||||
if (!isset($manipulation[$table]['class'])) {
|
if (!isset($manipulation[$table]['class'])) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user