Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
40fc84b3
Commit
40fc84b3
authored
Nov 25, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup & docs
parent
5164a167
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
14 deletions
+32
-14
ActiveQuery.php
extensions/elasticsearch/ActiveQuery.php
+1
-2
ActiveRecord.php
extensions/elasticsearch/ActiveRecord.php
+0
-1
Command.php
extensions/elasticsearch/Command.php
+0
-7
Connection.php
extensions/elasticsearch/Connection.php
+0
-3
Query.php
extensions/elasticsearch/Query.php
+31
-1
No files found.
extensions/elasticsearch/ActiveQuery.php
View file @
40fc84b3
...
@@ -6,10 +6,9 @@
...
@@ -6,10 +6,9 @@
*/
*/
namespace
yii\elasticsearch
;
namespace
yii\elasticsearch
;
use
Guzzle\Http\Client
;
use
yii\db\ActiveQueryInterface
;
use
yii\db\ActiveQueryInterface
;
use
yii\db\ActiveQueryTrait
;
use
yii\db\ActiveQueryTrait
;
use
yii\helpers\Json
;
/**
/**
* ActiveQuery represents a [[Query]] associated with an [[ActiveRecord]] class.
* ActiveQuery represents a [[Query]] associated with an [[ActiveRecord]] class.
...
...
extensions/elasticsearch/ActiveRecord.php
View file @
40fc84b3
...
@@ -10,7 +10,6 @@ namespace yii\elasticsearch;
...
@@ -10,7 +10,6 @@ namespace yii\elasticsearch;
use
yii\base\InvalidCallException
;
use
yii\base\InvalidCallException
;
use
yii\base\InvalidConfigException
;
use
yii\base\InvalidConfigException
;
use
yii\base\NotSupportedException
;
use
yii\base\NotSupportedException
;
use
yii\db\TableSchema
;
use
yii\helpers\Inflector
;
use
yii\helpers\Inflector
;
use
yii\helpers\Json
;
use
yii\helpers\Json
;
use
yii\helpers\StringHelper
;
use
yii\helpers\StringHelper
;
...
...
extensions/elasticsearch/Command.php
View file @
40fc84b3
...
@@ -7,16 +7,9 @@
...
@@ -7,16 +7,9 @@
namespace
yii\elasticsearch
;
namespace
yii\elasticsearch
;
use
Guzzle\Http\Exception\ClientErrorResponseException
;
use
yii\base\Component
;
use
yii\base\Component
;
use
yii\db\Exception
;
use
yii\helpers\Json
;
use
yii\helpers\Json
;
// camelCase vs. _
// http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/common-options.html#_result_casing
/**
/**
* The Command class implements the API for accessing the elasticsearch REST API.
* The Command class implements the API for accessing the elasticsearch REST API.
*
*
...
...
extensions/elasticsearch/Connection.php
View file @
40fc84b3
...
@@ -7,13 +7,10 @@
...
@@ -7,13 +7,10 @@
namespace
yii\elasticsearch
;
namespace
yii\elasticsearch
;
use
Guzzle\Http\Exception\ClientErrorResponseException
;
use
Yii
;
use
Yii
;
use
yii\base\Component
;
use
yii\base\Component
;
use
yii\base\Exception
;
use
yii\base\Exception
;
use
yii\base\InvalidConfigException
;
use
yii\base\InvalidConfigException
;
use
yii\helpers\Json
;
/**
/**
* elasticsearch Connection is used to connect to an elasticsearch cluster version 0.20 or higher
* elasticsearch Connection is used to connect to an elasticsearch cluster version 0.20 or higher
...
...
extensions/elasticsearch/Query.php
View file @
40fc84b3
...
@@ -14,7 +14,37 @@ use yii\db\QueryInterface;
...
@@ -14,7 +14,37 @@ use yii\db\QueryInterface;
use
yii\db\QueryTrait
;
use
yii\db\QueryTrait
;
/**
/**
* Class Query
* Query represents a query to the search API of elasticsearch.
*
* Query provides a set of methods to facilitate the specification of different parameters of the query.
* These methods can be chained together.
*
* By calling [[createCommand()]], we can get a [[Command]] instance which can be further
* used to perform/execute the DB query against a database.
*
* For example,
*
* ~~~
* $query = new Query;
* $query->fields('id, name')
* ->from('myindex', 'users')
* ->limit(10);
* // build and execute the query
* $command = $query->createCommand();
* $rows = $command->search(); // this way you get the raw output of elasticsearch.
* ~~~
*
* You would normally call `$query->search()` instead of creating a command as this method
* adds the `indexBy()` feature and also removes some inconsistencies from the response.
*
* Query also provides some methods to easier get some parts of the result only:
*
* - [[one()]]: returns a single record populated with the first row of data.
* - [[all()]]: returns all records based on the query results.
* - [[count()]]: returns the number of records.
* - [[scalar()]]: returns the value of the first column in the first row of the query result.
* - [[column()]]: returns the value of the first column in the query result.
* - [[exists()]]: returns a value indicating whether the query result has data or not.
*
*
* @author Carsten Brandt <mail@cebe.cc>
* @author Carsten Brandt <mail@cebe.cc>
* @since 2.0
* @since 2.0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment