Browse Source

docs

[ci skip]
tags/2.0.0-beta
Carsten Brandt 11 years ago
parent
commit
2cd0a2cdba
  1. 21
      framework/yii/elasticsearch/ActiveRecord.php
  2. 16
      framework/yii/elasticsearch/Cluster.php
  3. 6
      framework/yii/elasticsearch/Connection.php

21
framework/yii/elasticsearch/ActiveRecord.php

@ -15,12 +15,29 @@ use yii\helpers\Inflector;
use yii\helpers\Json; use yii\helpers\Json;
use yii\helpers\StringHelper; use yii\helpers\StringHelper;
// TODO handle optimistic lock
/** /**
* ActiveRecord is the base class for classes representing relational data in terms of objects. * ActiveRecord is the base class for classes representing relational data in terms of objects.
* *
* This class implements the ActiveRecord pattern for the fulltext search and data storage
* [elasticsearch](http://www.elasticsearch.org/).
*
* For defining a record a subclass should at least implement the [[attributes()]] method to define
* attributes.
* The primary key (the `_id` field in elasticsearch terms) is represented by `getId()` and `setId()`.
*
* The following is an example model called `Customer`:
*
* ```php
* class Customer extends \yii\elasticsearch\ActiveRecord
* {
* public function attributes()
* {
* return ['id', 'name', 'address', 'registration_date'];
* }
* }
* ```
* *
* You may override [[index()]] and [[type()]] to define the index and type this record represents.
* *
* @author Carsten Brandt <mail@cebe.cc> * @author Carsten Brandt <mail@cebe.cc>
* @since 2.0 * @since 2.0

16
framework/yii/elasticsearch/Cluster.php

@ -0,0 +1,16 @@
<?php
/**
*
*
* @author Carsten Brandt <mail@cebe.cc>
*/
namespace yii\elasticsearch;
use yii\base\Object;
class Cluster extends Object
{
// TODO implement http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster.html
}

6
framework/yii/elasticsearch/Connection.php

@ -34,6 +34,9 @@ class Connection extends Component
) )
); );
// http://www.elasticsearch.org/guide/en/elasticsearch/client/php-api/current/_configuration.html#_example_configuring_http_basic_auth
public $auth = [];
// TODO use timeouts // TODO use timeouts
/** /**
* @var float timeout to use for connection to redis. If not set the timeout set in php.ini will be used: ini_get("default_socket_timeout") * @var float timeout to use for connection to redis. If not set the timeout set in php.ini will be used: ini_get("default_socket_timeout")
@ -92,6 +95,9 @@ class Connection extends Component
*/ */
public function open() public function open()
{ {
// TODO select one node to be the active one.
foreach($this->nodes as $key => $node) { foreach($this->nodes as $key => $node) {
if (is_array($node)) { if (is_array($node)) {
$this->nodes[$key] = new Node($node); $this->nodes[$key] = new Node($node);

Loading…
Cancel
Save