Browse Source

Update README

master
Chimo 2 years ago
parent
commit
79e3358943
2 changed files with 15 additions and 23 deletions
  1. +12
    -21
      ElasticSearchPlugin.php
  2. +3
    -2
      README.md

+ 12
- 21
ElasticSearchPlugin.php View File

@@ -12,17 +12,15 @@ class ElasticSearchPlugin extends Plugin

function onGetSearchEngine(Memcached_DataObject $target, $table, &$search_engine)
{
if ($this->isEnabled()) {
$engine = $this->createEngine($target);
$engine = $this->createEngine($target);

// TODO: Error handling
// TODO: Error handling
// Consider falling back to built-in search on error
// (i.e.: returning `true`)

$search_engine = $engine;
$search_engine = $engine;

return false;
}

return true;
return false;
}

function onEndNoticeSaveWeb($action, $notice)
@@ -41,14 +39,12 @@ class ElasticSearchPlugin extends Plugin

function handleNoticeSave($notice)
{
if ($this->isEnabled()) {
$engine = $this->createEngine(new Notice());

if ($notice->getVerb(true) === 'delete') {
$engine->delete($notice);
} else {
$engine->index($notice);
}
$engine = $this->createEngine(new Notice());

if ($notice->getVerb(true) === 'delete') {
$engine->delete($notice);
} else {
$engine->index($notice);
}
}

@@ -75,11 +71,6 @@ class ElasticSearchPlugin extends Plugin
return $index_name;
}

function isEnabled()
{
return common_config('elasticsearch', 'enabled');
}

function onPluginVersion(array &$versions)
{
$versions[] = array('name' => 'Elasticsearch backend',


+ 3
- 2
README.md View File

@@ -11,7 +11,6 @@
Tell `/config.php` to use it with (replace `127.0.0.1:9200` with the address/port of your elasticsearch backend server):

```
$config['elasticsearch']['enabled'] = true;
$config['elasticsearch']['hosts'] = [ '127.0.0.1:9200' ];
$config['elasticsearch']['index_name'] = 'gnusocial';
addPlugin('ElasticSearch');
@@ -26,7 +25,9 @@ You can use the [Lucene query syntax](https://www.elastic.co/guide/en/elasticsea
Supported fields:

* text: Filters by notice text (default field)
* author: Filters by notice username
* author: Notice author (in webfinger format: username@example.org)
* type: Notice type (ex: post, share, like, etc)
* created: Date the notice was created

The `/search/notice` page searches notice text by default. You can filter by notice author with the `author` field parameter.



Loading…
Cancel
Save