Skip to content

Commit

Permalink
Typehint for search $options
Browse files Browse the repository at this point in the history
Example for routing in README.markdown
  • Loading branch information
fivetide committed Nov 16, 2012
1 parent 4dc31e6 commit 5f44966
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions README.markdown
Expand Up @@ -83,3 +83,16 @@ $es = Client::connection(array(
'type' => 'mytype'
));
```

### Support for Routing

```php
<?php
$document = array(
'title' => 'My routed document',
'user_id' => '42'
);
$es->index($document, $id, array('routing' => $document['user_id']));
$es->search('title:routed', array('routing' => '42'));
```

2 changes: 1 addition & 1 deletion src/ElasticSearch/Client.php
Expand Up @@ -190,7 +190,7 @@ public function index($document, $id=false, array $options = array()) {
* @return array
* @param array $document
*/
public function search($query, $options= array()) {
public function search($query, array $options = array()) {
$start = microtime(true);
$result = $this->transport->search($query, $options);
$result['time'] = microtime(true) - $start;
Expand Down
2 changes: 1 addition & 1 deletion src/ElasticSearch/Transport/HTTP.php
Expand Up @@ -53,7 +53,7 @@ public function index($document, $id=false, array $options = array()) {
* @return array
* @param mixed $id Optional
*/
public function search($query, $options=array()) {
public function search($query, array $options = array()) {
if (is_array($query)) {
/**
* Array implies using the JSON query DSL
Expand Down

0 comments on commit 5f44966

Please sign in to comment.