Skip to content

Commit cc60e8f

Browse files
committed
Changes.txt merge conflict resolved
2 parents 527136c + 165aacd commit cc60e8f

22 files changed

+300
-54
lines changed

README.markdown

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ Dependencies
2222
------------
2323
| Project | Version | Required |
2424
|---------|---------|----------|
25-
|[Elasticsearch](https://github.com/elasticsearch/elasticsearch/tree/v1.4.4)|1.4.4|yes|
26-
|[Elasticsearch mapper attachments plugin](https://github.com/elasticsearch/elasticsearch-mapper-attachments/tree/v2.4.2)|2.4.2|no|
27-
|[Elasticsearch thrift transport plugin](https://github.com/elasticsearch/elasticsearch-transport-thrift/tree/v2.4.1)|2.4.1|no|
28-
|[Elasticsearch memcached transport plugin](https://github.com/elasticsearch/elasticsearch-transport-memcached/tree/v2.4.1)|2.4.1|no|
25+
|[Elasticsearch](https://github.com/elasticsearch/elasticsearch/tree/v1.5.0)|1.5.0|yes|
26+
|[Elasticsearch mapper attachments plugin](https://github.com/elasticsearch/elasticsearch-mapper-attachments/tree/v2.5.0)|2.5.0|no|
27+
|[Elasticsearch thrift transport plugin](https://github.com/elasticsearch/elasticsearch-transport-thrift/tree/v2.5.0)|2.5.0|no|
28+
|[Elasticsearch memcached transport plugin](https://github.com/elasticsearch/elasticsearch-transport-memcached/tree/v2.5.0)|2.5.0|no|
2929
|[Elasticsearch geocluster facet plugin](https://github.com/zenobase/geocluster-facet/tree/0.0.12)|0.0.12|no|
30-
|[Elasticsearch image plugin](https://github.com/SibaTokyo/elasticsearch-image/tree/1.4.0)|1.4.0|no|
30+
|[Elasticsearch image plugin](https://github.com/SibaTokyo/elasticsearch-image/tree/1.4.0)|1.4.0|no|

ansible/es-playbook.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
hosts: localhost
66
sudo: true
77
vars:
8-
- ES_VER: "1.4.4"
9-
- ES_SHORT_VER: "1.4"
10-
- ES_MAPPER_ATTACHMENTS_VER: "2.4.2"
11-
- ES_TRANSPORT_MEMCACHED_VER: "2.4.1"
12-
- ES_TRANSPORT_THRIFT_VER: "2.4.1"
8+
- ES_VER: "1.5.0"
9+
- ES_SHORT_VER: "1.5"
10+
- ES_MAPPER_ATTACHMENTS_VER: "2.5.0"
11+
- ES_TRANSPORT_MEMCACHED_VER: "2.5.0"
12+
- ES_TRANSPORT_THRIFT_VER: "2.5.0"
1313
- ES_GEOCLUSTER_FACET_VER: "0.0.12"
1414
- ES_IMAGE_PLUGIN_VER: "1.4.0"
1515
- ES_PROJECT_ROOT: "{{ lookup('env', 'ES_PROJECT_ROOT') }}"

changes.txt

+18-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,23 @@ CHANGES
33
2015-04-15
44
- deleteByQuery() implemented in Elastica\Index
55

6+
2015-04-09
7+
- Added Elastica\Query\SimpleQueryString::setMinimumShouldMatch
8+
- Added Elastica\Query\FunctionScore::setMinScore
9+
- Added Elastica\Query\MoreLikeThis::setMinimumShouldMatch
10+
11+
2015-04-08
12+
- Added new methods to Elastica\Aggregation\DateHistogram: setOffset, setTimezone
13+
- Following methods in Elastica\Aggregation\DateHistogram marked as deprecated: setPreOffset, setPostOffset, setPreZone, setPostZone, setPreZoneAdjustLargeInterval
14+
15+
2015-04-07
16+
- [BC break] Elastica\Query\QueryString::setLowercaseExpandedTerms removed
17+
- Added Elastica\Query\QueryString::setTimezone
18+
19+
2015-04-06
20+
- Update Elasticsearch version to 1.5
21+
- Added deprecation notice to Elastica\Transport\Thrift, Elastica\Transport\Memcached and Elastica\Type::deleteByQuery
22+
623
2015-03-29
724
- Added Elastica\Suggest\Completion
825

@@ -39,7 +56,7 @@ CHANGES
3956
- Add support for filters aggregation #773
4057

4158
2015-01-27
42-
- Housekeeping, coding standard #764
59+
- Housekeeping, coding standard #764
4360
- Exception\ElasticsearchException now can be catched like all other exceptions as Exception\ExceptionInterface #762
4461

4562
2015-01-25

lib/Elastica/Aggregation/DateHistogram.php

+37
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ class DateHistogram extends Histogram
1111
{
1212
/**
1313
* Set pre-rounding based on interval
14+
*
15+
* @deprecated Option "pre_zone" is deprecated as of ES 1.5. Use "time_zone" instead
16+
*
1417
* @param string $preZone
1518
* @return $this
1619
*/
@@ -21,6 +24,9 @@ public function setPreZone($preZone)
2124

2225
/**
2326
* Set post-rounding based on interval
27+
*
28+
* @deprecated Option "post_zone" is deprecated as of ES 1.5. Use "time_zone" instead
29+
*
2430
* @param string $postZone
2531
* @return $this
2632
*/
@@ -29,8 +35,22 @@ public function setPostZone($postZone)
2935
return $this->setParam("post_zone", $postZone);
3036
}
3137

38+
/**
39+
* Set time_zone option
40+
*
41+
* @param string
42+
* @return $this
43+
*/
44+
public function setTimezone($timezone)
45+
{
46+
return $this->setParam('time_zone', $timezone);
47+
}
48+
3249
/**
3350
* Set pre-zone adjustment for larger time intervals (day and above)
51+
*
52+
* @deprecated Option "pre_zone_adjust_large_interval" is deprecated as of ES 1.5
53+
*
3454
* @param string $adjust
3555
* @return $this
3656
*/
@@ -51,6 +71,9 @@ public function setFactor($factor)
5171

5272
/**
5373
* Set the offset for pre-rounding
74+
*
75+
* @deprecated Option "pre_offset" is deprecated as of ES 1.5. Use "offset" instead
76+
*
5477
* @param string $offset "1d", for example
5578
* @return $this
5679
*/
@@ -61,6 +84,9 @@ public function setPreOffset($offset)
6184

6285
/**
6386
* Set the offset for post-rounding
87+
*
88+
* @deprecated Option "post_offset" is deprecated as of ES 1.5. Use "offset" instead
89+
*
6490
* @param string $offset "1d", for example
6591
* @return $this
6692
*/
@@ -69,6 +95,17 @@ public function setPostOffset($offset)
6995
return $this->setParam("post_offset", $offset);
7096
}
7197

98+
/**
99+
* Set offset option
100+
*
101+
* @param string
102+
* @return $this
103+
*/
104+
public function setOffset($offset)
105+
{
106+
return $this->setParam("offset", $offset);
107+
}
108+
72109
/**
73110
* Set the format for returned bucket key_as_string values
74111
* @link http://www.elastic.co/guide/en/elasticsearch/reference/master/search-aggregations-bucket-daterange-aggregation.html#date-format-pattern

lib/Elastica/Query/FunctionScore.php

+11
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,17 @@ public function setScoreMode($mode)
218218
return $this->setParam('score_mode', $mode);
219219
}
220220

221+
/**
222+
* Set min_score option.
223+
*
224+
* @param float $minScore
225+
* @return $this
226+
*/
227+
public function setMinScore($minScore)
228+
{
229+
return $this->setParam('min_score', (float) $minScore);
230+
}
231+
221232
/**
222233
* @return array
223234
*/

lib/Elastica/Query/MoreLikeThis.php

+13
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ public function setMaxQueryTerms($maxQueryTerms)
7575
*
7676
* @param float $percentTermsToMatch Percentage
7777
* @return $this
78+
*
79+
* @deprecated Option "percent_terms_to_match" deprecated as of ES 1.5. Use "minimum_should_match" instead.
7880
*/
7981
public function setPercentTermsToMatch($percentTermsToMatch)
8082
{
@@ -170,4 +172,15 @@ public function setStopWords(array $stopWords)
170172
{
171173
return $this->setParam('stop_words', $stopWords);
172174
}
175+
176+
/**
177+
* Set minimum_should_match option.
178+
*
179+
* @param int|string $minimumShouldMatch
180+
* @return $this
181+
*/
182+
public function setMinimumShouldMatch($minimumShouldMatch)
183+
{
184+
return $this->setParam('minimum_should_match', $minimumShouldMatch);
185+
}
173186
}

lib/Elastica/Query/MultiMatch.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ public function setOperator($operator = 'or')
9090
/**
9191
* Set field minimum should match for Match Query
9292
*
93-
* @param int $minimumShouldMatch
93+
* @param mixed $minimumShouldMatch
9494
* @return $this
9595
*/
9696
public function setMinimumShouldMatch($minimumShouldMatch)
9797
{
98-
return $this->setParam('minimum_should_match', (int) $minimumShouldMatch);
98+
return $this->setParam('minimum_should_match', $minimumShouldMatch);
9999
}
100100

101101
/**

lib/Elastica/Query/QueryString.php

+11-13
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,6 @@ public function setAllowLeadingWildcard($allow = true)
9898
return $this->setParam('allow_leading_wildcard', (bool) $allow);
9999
}
100100

101-
/**
102-
* Sets the parameter to auto-lowercase terms of some queries.
103-
*
104-
* If not set, defaults to true.
105-
*
106-
* @param bool $lowercase
107-
* @return $this
108-
*/
109-
public function setLowercaseExpandedTerms($lowercase = true)
110-
{
111-
return $this->setParam('lowercase_expanded_terms', (bool) $lowercase);
112-
}
113-
114101
/**
115102
* Sets the parameter to enable the position increments in result queries.
116103
*
@@ -255,6 +242,17 @@ public function setRewrite($rewrite = "")
255242
return $this->setParam('rewrite', $rewrite);
256243
}
257244

245+
/**
246+
* Set timezone option.
247+
*
248+
* @param string $timezone
249+
* @return $this
250+
*/
251+
public function setTimezone($timezone)
252+
{
253+
return $this->setParam('time_zone', $timezone);
254+
}
255+
258256
/**
259257
* Converts query to array
260258
*

lib/Elastica/Query/SimpleQueryString.php

+11
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,15 @@ public function setAnalyzer($analyzer)
6262
{
6363
return $this->setParam("analyzer", $analyzer);
6464
}
65+
66+
/**
67+
* Set minimum_should_match option.
68+
*
69+
* @param int|string $minimumShouldMatch
70+
* @return $this
71+
*/
72+
public function setMinimumShouldMatch($minimumShouldMatch)
73+
{
74+
return $this->setParam("minimum_should_match", $minimumShouldMatch);
75+
}
6576
}

lib/Elastica/QueryBuilder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Elastica\QueryBuilder\DSL;
77
use Elastica\QueryBuilder\Facade;
88
use Elastica\QueryBuilder\Version;
9-
use Elastica\QueryBuilder\Version\Version140;
9+
use Elastica\QueryBuilder\Version\Version150;
1010

1111
/**
1212
* Query Builder
@@ -33,7 +33,7 @@ class QueryBuilder
3333
*/
3434
public function __construct(Version $version = null)
3535
{
36-
$this->_version = $version ?: new Version140();
36+
$this->_version = $version ?: new Version150();
3737

3838
$this->addDSL(new DSL\Query());
3939
$this->addDSL(new DSL\Filter());

lib/Elastica/QueryBuilder/DSL/Query.php

+1
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ public function more_like_this()
322322
* more_like_this_field query
323323
*
324324
* @link http://www.elastic.co/guide/en/elasticsearch/reference/1.4/query-dsl-mlt-field-query.html
325+
* @deprecated More Like This Field query is deprecated as of ES 1.4 and will be removed in ES 2.0
325326
*/
326327
public function more_like_this_field()
327328
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Elastica\QueryBuilder\Version;
4+
5+
/**
6+
* elasticsearch 1.5 DSL
7+
*
8+
* @link http://www.elastic.co/guide/en/elasticsearch/reference/1.5/index.html
9+
* @author Igor Denisenko <[email protected]>
10+
*/
11+
class Version150 extends Version140
12+
{
13+
// nothing was added nor removed
14+
}

lib/Elastica/Transport/Memcache.php

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* @category Xodoa
1717
* @package Elastica
1818
* @author Nicolas Ruflin <[email protected]>
19+
* @deprecated The memcached transport is deprecated as of ES 1.5, and will be removed in ES 2.0
1920
*/
2021
class Memcache extends AbstractTransport
2122
{

lib/Elastica/Transport/Thrift.php

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
* @category Xodoa
2727
* @package Elastica
2828
* @author Mikhail Shamin <[email protected]>
29+
* @deprecated The thrift transport is deprecated as of ES 1.5, and will be removed in ES 2.0
2930
*/
3031
class Thrift extends AbstractTransport
3132
{

lib/Elastica/Type.php

+1
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ public function deleteIds(array $ids, $routing = false)
452452
* @param array $options Optional params
453453
* @return \Elastica\Response
454454
* @link http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html
455+
* @deprecated Delete by Query api is deprecated as of ES 1.5, and will be removed in ES 2.0
455456
*/
456457
public function deleteByQuery($query, array $options = array())
457458
{

test/lib/Elastica/Test/Aggregation/DateHistogramTest.php

+53-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ protected function setUp()
2020
$type = $this->_index->getType("test");
2121
$type->setMapping($mapping);
2222
$docs = array(
23-
new Document("1", array("created" => 1390962135000)),
24-
new Document("2", array("created" => 1390965735000)),
25-
new Document("3", array("created" => 1390954935000)),
23+
new Document("1", array("created" => "2014-01-29T00:20:00")),
24+
new Document("2", array("created" => "2014-01-29T02:20:00")),
25+
new Document("3", array("created" => "2014-01-29T03:20:00")),
2626
);
2727
$type->addDocuments($docs);
2828
$this->_index->refresh();
@@ -38,4 +38,54 @@ public function testDateHistogramAggregation()
3838

3939
$this->assertEquals(3, sizeof($results['buckets']));
4040
}
41+
42+
public function testSetOffset()
43+
{
44+
$agg = new DateHistogram('hist', 'created', '1h');
45+
46+
$agg->setOffset('3m');
47+
48+
$expected = array(
49+
'date_histogram' => array(
50+
'field' => 'created',
51+
'interval' => '1h',
52+
'offset' => '3m',
53+
),
54+
);
55+
56+
$this->assertEquals($expected, $agg->toArray());
57+
58+
$this->assertInstanceOf('Elastica\Aggregation\DateHistogram', $agg->setOffset('3m'));
59+
}
60+
61+
public function testSetOffsetWorks()
62+
{
63+
$agg = new DateHistogram('hist', 'created', '1m');
64+
$agg->setOffset('+40s');
65+
66+
$query = new Query();
67+
$query->addAggregation($agg);
68+
$results = $this->_index->search($query)->getAggregation('hist');
69+
70+
$this->assertEquals('2014-01-29T00:19:40.000Z', $results['buckets'][0]['key_as_string']);
71+
}
72+
73+
public function testSetTimezone()
74+
{
75+
$agg = new DateHistogram('hist', 'created', '1h');
76+
77+
$agg->setTimezone('-02:30');
78+
79+
$expected = array(
80+
'date_histogram' => array(
81+
'field' => 'created',
82+
'interval' => '1h',
83+
'time_zone' => '-02:30',
84+
),
85+
);
86+
87+
$this->assertEquals($expected, $agg->toArray());
88+
89+
$this->assertInstanceOf('Elastica\Aggregation\DateHistogram', $agg->setTimezone('-02:30'));
90+
}
4191
}

0 commit comments

Comments
 (0)