Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Search and DSL changes #1369

Merged
merged 1 commit into from
Sep 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ All notable changes to this project will be documented in this file based on the
- Removed old / removed script language support : javascript, python, mvel [#1364](https://github.com/ruflin/Elastica/pull/1364)
- 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)
- [Unfiltered nested source](https://github.com/elastic/elasticsearch/pull/26102) should keep its full path [#1366](https://github.com/ruflin/Elastica/pull/1366)

- 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)
- 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)
- The geo_distance_range query, which was deprecated in 5.0, has been removed. [#1369](https://github.com/ruflin/Elastica/pull/1369)
- The optimize_bbox parameter has been removed from geo_distance queries. [#1369](https://github.com/ruflin/Elastica/pull/1369)
- 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)
### Bugfixes
- 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)
- 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.
Expand Down
3 changes: 1 addition & 2 deletions lib/Elastica/Aggregation/GeoDistance.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/
class GeoDistance extends AbstractAggregation
{
const DISTANCE_TYPE_SLOPPY_ARC = 'sloppy_arc';
const DISTANCE_TYPE_ARC = 'arc';
const DISTANCE_TYPE_PLANE = 'plane';

Expand Down Expand Up @@ -93,7 +92,7 @@ public function setUnit($unit)
/**
* Set the method by which distances will be calculated.
*
* @param string $distanceType see DISTANCE_TYPE_* constants for options. Defaults to sloppy_arc.
* @param string $distanceType see DISTANCE_TYPE_* constants for options. Defaults to arc.
*
* @return $this
*/
Expand Down
16 changes: 0 additions & 16 deletions lib/Elastica/Query/BoolQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,6 @@ public function setBoost($boost)
return $this->setParam('boost', $boost);
}

/**
* Set the minimum number of of should match.
*
* @param int $minimumNumberShouldMatch Should match minimum
*
* @return $this
*
* @deprecated Replaced by setMinimumShouldMatch
*/
public function setMinimumNumberShouldMatch($minimumNumberShouldMatch)
{
trigger_error('Deprecated: Elastica\Query::setMinimumNumberShouldMatch() is deprecated and will be removed in further Elastica releases. Use Elastica\Query::setMinimumShouldMatch() instead.', E_USER_DEPRECATED);

return $this->setParam('minimum_number_should_match', $minimumNumberShouldMatch);
}

/**
* Sets the minimum number of should clauses to match.
*
Expand Down
12 changes: 0 additions & 12 deletions lib/Elastica/Query/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,6 @@ public function setAnalyzer($analyzer)
return $this->setQueryParam('analyzer', $analyzer);
}

/**
* Enable / disable computation of score factor based on the fraction of all query terms contained in the document.
*
* @param bool $disable disable_coord is false by default
*
* @return $this
*/
public function setDisableCoord($disable = true)
{
return $this->setQueryParam('disable_coord', (bool) $disable);
}

/**
* Set a parameter in the body of this query.
*
Expand Down
21 changes: 1 addition & 20 deletions lib/Elastica/Query/GeoDistance.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ class GeoDistance extends AbstractGeoDistance
{
const DISTANCE_TYPE_ARC = 'arc';
const DISTANCE_TYPE_PLANE = 'plane';
const DISTANCE_TYPE_SLOPPY_ARC = 'sloppy_arc';

const OPTIMIZE_BBOX_MEMORY = 'memory';
const OPTIMIZE_BBOX_INDEXED = 'indexed';
const OPTIMIZE_BBOX_NONE = 'none';

/**
* Create GeoDistance object.
Expand Down Expand Up @@ -49,7 +44,7 @@ public function setDistance($distance)
/**
* See DISTANCE_TYPE_* constants.
*
* @param string $distanceType
* @param string $distanceType, default arc
*
* @return $this
*/
Expand All @@ -59,18 +54,4 @@ public function setDistanceType($distanceType)

return $this;
}

/**
* See OPTIMIZE_BBOX_* constants.
*
* @param string $optimizeBbox
*
* @return $this
*/
public function setOptimizeBbox($optimizeBbox)
{
$this->setParam('optimize_bbox', $optimizeBbox);

return $this;
}
}
105 changes: 0 additions & 105 deletions lib/Elastica/Query/GeoDistanceRange.php

This file was deleted.

12 changes: 0 additions & 12 deletions lib/Elastica/Query/Percolate.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ public function setDocument($document)
return $this->setParam('document', $document);
}

/**
* The type / mapping of the document being percolated. This is a required parameter.
*
* @param $documentType
*
* @return $this
*/
public function setDocumentType($documentType)
{
return $this->setParam('document_type', $documentType);
}

/**
* The index the document resides in.
*
Expand Down
52 changes: 0 additions & 52 deletions test/Elastica/Query/BoolQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,58 +58,6 @@ public function testToArray()
$this->assertEquals($expectedArray, $query->toArray());
}

/**
* @group unit
*/
public function testToArrayWithLegacyMinimumNumberShouldMatch()
{
$query = new BoolQuery();

$idsQuery1 = new Ids();
$idsQuery1->setIds(1);

$idsQuery2 = new Ids();
$idsQuery2->setIds(2);

$idsQuery3 = new Ids();
$idsQuery3->setIds(3);

$this->hideDeprecated();
$filter1 = new Term();
$filter1->setTerm('test', '1');

$filter2 = new Term();
$filter2->setTerm('username', 'ruth');
$this->showDeprecated();

$boost = 1.2;
$minMatch = 2;

$query->setBoost($boost);

$query->addMust($idsQuery1);
$query->addMustNot($idsQuery2);
$query->addShould($idsQuery3->toArray());
$query->addFilter($filter1);
$query->addFilter($filter2);
$this->hideDeprecated();
$query->setMinimumNumberShouldMatch($minMatch);
$this->showDeprecated();

$expectedArray = [
'bool' => [
'must' => [$idsQuery1->toArray()],
'should' => [$idsQuery3->toArray()],
'filter' => [$filter1->toArray(), $filter2->toArray()],
'minimum_number_should_match' => $minMatch,
'must_not' => [$idsQuery2->toArray()],
'boost' => $boost,
],
];

$this->assertEquals($expectedArray, $query->toArray());
}

/**
* Test to resolve the following issue.
*
Expand Down
Loading