From 0fc537ab28267b1ac4f8142e69ca26fe643449b2 Mon Sep 17 00:00:00 2001 From: Nick Law Date: Wed, 5 Apr 2017 17:51:35 +1000 Subject: [PATCH] Fix DirectGenerator deprecation errors Deprecation of the below is now enforced in 5.3 - "prefix_len" becomes "prefix_length" - "min_word_len" becomes "min_word_length" --- CHANGELOG.md | 2 ++ lib/Elastica/Suggest/CandidateGenerator/DirectGenerator.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c4f25cbe6..8911a8f5bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,8 @@ All notable changes to this project will be documented in this file based on the - Deprecated `\Elastica\Exception\ElasticsearchException` which is irrelevant since Elasticsearch now exposes the errors as a structured array instead of a single string. Use `\Elastica\Exception\ResponseException::getResponse::getFullError` instead. +- Deprecated both `prefix_len` & `min_word_len` fields in `Elastica\Suggest\CandidateGenerator\DirectGenerator` as these now return errors when using the phrase suggester to querying terms. + Use `prefix_length` & `min_word_length` instead [#1282](https://github.com/ruflin/Elastica/pull/1282) ## [5.1.0](https://github.com/ruflin/Elastica/compare/5.0.0...5.1.0) diff --git a/lib/Elastica/Suggest/CandidateGenerator/DirectGenerator.php b/lib/Elastica/Suggest/CandidateGenerator/DirectGenerator.php index 4e57052c40..cf01cdc7c0 100644 --- a/lib/Elastica/Suggest/CandidateGenerator/DirectGenerator.php +++ b/lib/Elastica/Suggest/CandidateGenerator/DirectGenerator.php @@ -71,7 +71,7 @@ public function setMaxEdits($max) */ public function setPrefixLength($length) { - return $this->setParam('prefix_len', $length); + return $this->setParam('prefix_length', $length); } /** @@ -81,7 +81,7 @@ public function setPrefixLength($length) */ public function setMinWordLength($min) { - return $this->setParam('min_word_len', $min); + return $this->setParam('min_word_length', $min); } /**