Skip to content

Commit 9efdbe5

Browse files
p365labsruflin
authored andcommitted
Remove Search and DSL changes (#1369)
- The deprecated minimum_number_should_match parameter in the bool query has been removed, use minimum_should_match instead. - For geo_distance queries, sorting, and aggregations the sloppy_arc option has been removed from the distance_type parameter. - The geo_distance_range query, which was deprecated in 5.0, has been removed. - The optimize_bbox parameter has been removed from geo_distance queries. - The disable_coord parameter of the bool and common_terms queries has been removed. If provided, it will be ignored and issue a deprecation warning. - The percolate query’s document_type has been deprecated. From 6.0 and later it is no longer required to specify the document_type parameter.
1 parent 80c3912 commit 9efdbe5

11 files changed

+7
-405
lines changed

CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ All notable changes to this project will be documented in this file based on the
2121
- Removed old / removed script language support : javascript, python, mvel [#1364](https://github.com/ruflin/Elastica/pull/1364)
2222
- Disable [_all](https://github.com/elastic/elasticsearch/pull/22144) by default, disallow configuring _all on 6.0+ indices [#1365](https://github.com/ruflin/Elastica/pull/1365)
2323
- [Unfiltered nested source](https://github.com/elastic/elasticsearch/pull/26102) should keep its full path [#1366](https://github.com/ruflin/Elastica/pull/1366)
24-
24+
- The deprecated minimum_number_should_match parameter in the bool query has been removed, use minimum_should_match instead. [#1369](https://github.com/ruflin/Elastica/pull/1369)
25+
- For geo_distance queries, sorting, and aggregations the sloppy_arc option has been removed from the distance_type parameter. [#1369](https://github.com/ruflin/Elastica/pull/1369)
26+
- The geo_distance_range query, which was deprecated in 5.0, has been removed. [#1369](https://github.com/ruflin/Elastica/pull/1369)
27+
- The optimize_bbox parameter has been removed from geo_distance queries. [#1369](https://github.com/ruflin/Elastica/pull/1369)
28+
- The disable_coord parameter of the bool and common_terms queries has been removed. If provided, it will be ignored and issue a deprecation warning. [#1369](https://github.com/ruflin/Elastica/pull/1369)
2529
### Bugfixes
2630
- Enforce [Content-Type requirement on the layer Rest](https://github.com/elastic/elasticsearch/pull/23146), a [PR on Elastica #1301](https://github.com/ruflin/Elastica/issues/1301) solved it (it has been implemented only in the HTTP Transport), but it was not implemented in the Guzzle Transport. [#1349](https://github.com/ruflin/Elastica/pull/1349)
2731
- Scroll no longer does an extra iteration both on an empty result and on searches where the last page has a significantly smaller number of results than the pages before it.

lib/Elastica/Aggregation/GeoDistance.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
*/
1111
class GeoDistance extends AbstractAggregation
1212
{
13-
const DISTANCE_TYPE_SLOPPY_ARC = 'sloppy_arc';
1413
const DISTANCE_TYPE_ARC = 'arc';
1514
const DISTANCE_TYPE_PLANE = 'plane';
1615

@@ -93,7 +92,7 @@ public function setUnit($unit)
9392
/**
9493
* Set the method by which distances will be calculated.
9594
*
96-
* @param string $distanceType see DISTANCE_TYPE_* constants for options. Defaults to sloppy_arc.
95+
* @param string $distanceType see DISTANCE_TYPE_* constants for options. Defaults to arc.
9796
*
9897
* @return $this
9998
*/

lib/Elastica/Query/BoolQuery.php

-16
Original file line numberDiff line numberDiff line change
@@ -91,22 +91,6 @@ public function setBoost($boost)
9191
return $this->setParam('boost', $boost);
9292
}
9393

94-
/**
95-
* Set the minimum number of of should match.
96-
*
97-
* @param int $minimumNumberShouldMatch Should match minimum
98-
*
99-
* @return $this
100-
*
101-
* @deprecated Replaced by setMinimumShouldMatch
102-
*/
103-
public function setMinimumNumberShouldMatch($minimumNumberShouldMatch)
104-
{
105-
trigger_error('Deprecated: Elastica\Query::setMinimumNumberShouldMatch() is deprecated and will be removed in further Elastica releases. Use Elastica\Query::setMinimumShouldMatch() instead.', E_USER_DEPRECATED);
106-
107-
return $this->setParam('minimum_number_should_match', $minimumNumberShouldMatch);
108-
}
109-
11094
/**
11195
* Sets the minimum number of should clauses to match.
11296
*

lib/Elastica/Query/Common.php

-12
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,6 @@ public function setAnalyzer($analyzer)
133133
return $this->setQueryParam('analyzer', $analyzer);
134134
}
135135

136-
/**
137-
* Enable / disable computation of score factor based on the fraction of all query terms contained in the document.
138-
*
139-
* @param bool $disable disable_coord is false by default
140-
*
141-
* @return $this
142-
*/
143-
public function setDisableCoord($disable = true)
144-
{
145-
return $this->setQueryParam('disable_coord', (bool) $disable);
146-
}
147-
148136
/**
149137
* Set a parameter in the body of this query.
150138
*

lib/Elastica/Query/GeoDistance.php

+1-20
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ class GeoDistance extends AbstractGeoDistance
1212
{
1313
const DISTANCE_TYPE_ARC = 'arc';
1414
const DISTANCE_TYPE_PLANE = 'plane';
15-
const DISTANCE_TYPE_SLOPPY_ARC = 'sloppy_arc';
16-
17-
const OPTIMIZE_BBOX_MEMORY = 'memory';
18-
const OPTIMIZE_BBOX_INDEXED = 'indexed';
19-
const OPTIMIZE_BBOX_NONE = 'none';
2015

2116
/**
2217
* Create GeoDistance object.
@@ -49,7 +44,7 @@ public function setDistance($distance)
4944
/**
5045
* See DISTANCE_TYPE_* constants.
5146
*
52-
* @param string $distanceType
47+
* @param string $distanceType, default arc
5348
*
5449
* @return $this
5550
*/
@@ -59,18 +54,4 @@ public function setDistanceType($distanceType)
5954

6055
return $this;
6156
}
62-
63-
/**
64-
* See OPTIMIZE_BBOX_* constants.
65-
*
66-
* @param string $optimizeBbox
67-
*
68-
* @return $this
69-
*/
70-
public function setOptimizeBbox($optimizeBbox)
71-
{
72-
$this->setParam('optimize_bbox', $optimizeBbox);
73-
74-
return $this;
75-
}
7657
}

lib/Elastica/Query/GeoDistanceRange.php

-105
This file was deleted.

lib/Elastica/Query/Percolate.php

-12
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,6 @@ public function setDocument($document)
3737
return $this->setParam('document', $document);
3838
}
3939

40-
/**
41-
* The type / mapping of the document being percolated. This is a required parameter.
42-
*
43-
* @param $documentType
44-
*
45-
* @return $this
46-
*/
47-
public function setDocumentType($documentType)
48-
{
49-
return $this->setParam('document_type', $documentType);
50-
}
51-
5240
/**
5341
* The index the document resides in.
5442
*

test/Elastica/Query/BoolQueryTest.php

-52
Original file line numberDiff line numberDiff line change
@@ -58,58 +58,6 @@ public function testToArray()
5858
$this->assertEquals($expectedArray, $query->toArray());
5959
}
6060

61-
/**
62-
* @group unit
63-
*/
64-
public function testToArrayWithLegacyMinimumNumberShouldMatch()
65-
{
66-
$query = new BoolQuery();
67-
68-
$idsQuery1 = new Ids();
69-
$idsQuery1->setIds(1);
70-
71-
$idsQuery2 = new Ids();
72-
$idsQuery2->setIds(2);
73-
74-
$idsQuery3 = new Ids();
75-
$idsQuery3->setIds(3);
76-
77-
$this->hideDeprecated();
78-
$filter1 = new Term();
79-
$filter1->setTerm('test', '1');
80-
81-
$filter2 = new Term();
82-
$filter2->setTerm('username', 'ruth');
83-
$this->showDeprecated();
84-
85-
$boost = 1.2;
86-
$minMatch = 2;
87-
88-
$query->setBoost($boost);
89-
90-
$query->addMust($idsQuery1);
91-
$query->addMustNot($idsQuery2);
92-
$query->addShould($idsQuery3->toArray());
93-
$query->addFilter($filter1);
94-
$query->addFilter($filter2);
95-
$this->hideDeprecated();
96-
$query->setMinimumNumberShouldMatch($minMatch);
97-
$this->showDeprecated();
98-
99-
$expectedArray = [
100-
'bool' => [
101-
'must' => [$idsQuery1->toArray()],
102-
'should' => [$idsQuery3->toArray()],
103-
'filter' => [$filter1->toArray(), $filter2->toArray()],
104-
'minimum_number_should_match' => $minMatch,
105-
'must_not' => [$idsQuery2->toArray()],
106-
'boost' => $boost,
107-
],
108-
];
109-
110-
$this->assertEquals($expectedArray, $query->toArray());
111-
}
112-
11361
/**
11462
* Test to resolve the following issue.
11563
*

0 commit comments

Comments
 (0)