2017 © Pedro Peláez
 

cakephp-plugin bounce

A very lightweight CakePhp plugin to make your models automagically indexable by Elastic Search

image

kamisama/bounce

A very lightweight CakePhp plugin to make your models automagically indexable by Elastic Search

  • Saturday, May 18, 2013
  • by kamisama
  • Repository
  • 1 Watchers
  • 5 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Bounce Build Status Coverage Status Dependency Status

A very lightweight CakePhp plugin to make your models automagically indexable by Elastic Search, (*1)

Just install the plugin and attach the Bounce.Indexable, … and voila ! It's the simplest plugin to easily get your CakePHP hooked with Elastic Search., (*2)

Installation

Via git

clone git://github.com/kamisama/bounce.git path/to/app/Plugin/Bounce

Via Composer

Just add kamisama/bounce to your require, in your app composer.json., (*3)

Load the plugin

Load the plugin into your app by editing your Config/bootstrap.php, (*4)

CakePlugin::loadAll(array('Bounce' => array('bootstrap' => true)));

Configuration

You can edit the connection info to your elastic search server in Bounce/Config/bootstrap, (*5)

Configure::write('Bounce', array(
    'host' => '127.0.0.1',
    'port' => '9200'
));

Then attach the Indexable Behavior to your model, (*6)

public $actAs = array('Bounce.Indexable');

The behavior offers a few options :, (*7)

  • index (string): specify the index name of your model, default to main
  • type (string): specify the type name of your model, default to your model alias
  • mapping (string): specify which fields you want to index in elastic search, default to false, will index all fields.

Example

class Song extends AppModel
{

    public $actAs = array('Bounce.Indexable' => array(
        'index' => 'music',
        'type' => 'song',
        'mapping' => array(
            'title' => 'string',
            'track' => 'integer',
            'length' => 'integer'
        )
    ));
}

The behavior will then only index the title, track and length fields, all the other field will be ignored. The values are used only for the mapping., (*8)

You model will automatically indexed on save, on update and on delete., (*9)

Notes

This plugin does not offers search function, it just index your models. If you want more advanced and complex indexing functions, check out the other plugin by kvz., (*10)

The Versions

18/05 2013

dev-master

9999999-dev https://github.com/kamisama/bounce

A very lightweight CakePhp plugin to make your models automagically indexable by Elastic Search

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin cakephp elasticsearch