Skip to content

Commit

Permalink
Mark dontUseTimestampsInIndex as deprecated.
Browse files Browse the repository at this point in the history
  • Loading branch information
timgws committed Feb 2, 2016
1 parent 0234890 commit 2e92b8f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
6 changes: 2 additions & 4 deletions src/ElasticquentResultCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ class ElasticquentResultCollection extends \Illuminate\Database\Eloquent\Collect
protected $instance;

/**
* _construct
* Create a new instance containing Elasticsearch results
*
* @param $results elasticsearch results
* @param $results elasticsearch results
* @param $instance
*
* @return \Elasticquent\ElasticquentResultCollection
*/
public function __construct($results, $instance)
{
Expand Down
21 changes: 11 additions & 10 deletions src/ElasticquentTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@ public function newCollection(array $models = array())
*/
public function getIndexName()
{
// The first thing we check is if there
// is an elasticquery config file and if there is a
// default index.
// The first thing we check is if there is an elasticquent
// config file and if there is a default index.
$index_name = $this->getElasticConfig('default_index');

if (!empty($index_name)) {
Expand Down Expand Up @@ -111,17 +110,19 @@ public function usesTimestampsInIndex()
/**
* Use Timestamps In Index.
*/
public function useTimestampsInIndex()
public function useTimestampsInIndex($shouldUse = true)
{
$this->usesTimestampsInIndex = true;
$this->usesTimestampsInIndex = $shouldUse;
}

/**
* Don't Use Timestamps In Index.
*
* @deprecated
*/
public function dontUseTimestampsInIndex()
{
$this->usesTimestampsInIndex = false;
$this->useTimestampsInIndex(false);
}

/**
Expand Down Expand Up @@ -267,7 +268,7 @@ public static function searchByQuery($query = null, $aggregations = null, $sourc
*
* Using this method, a custom query can be sent to Elasticsearch.
*
* @param $params
* @param $params parameters to be passed directly to Elasticsearch
* @return ElasticquentResultCollection
*/
public static function complexSearch($params)
Expand Down Expand Up @@ -410,8 +411,8 @@ public function getBasicEsParams($getIdIfPossible = true, $getSourceIfPossible =
/**
* Build the 'fields' parameter depending on given options.
*
* @param bool $getSourceIfPossible
* @param bool $getTimestampIfPossible
* @param bool $getSourceIfPossible
* @param bool $getTimestampIfPossible
* @return array
*/
private function buildFieldsParameter($getSourceIfPossible, $getTimestampIfPossible)
Expand Down Expand Up @@ -602,7 +603,7 @@ public function newFromHitBuilder($hit = array())
}
}

$instance->setRawAttributes((array) $attributes, true);
$instance->setRawAttributes((array)$attributes, true);

// In addition to setting the attributes
// from the index, we will set the score as well.
Expand Down

0 comments on commit 2e92b8f

Please sign in to comment.