From ac6e0de0c19c1245873683382dc2d00ef3f8a4c2 Mon Sep 17 00:00:00 2001 From: Foad Yousefi Date: Thu, 7 Jan 2021 21:42:02 +0100 Subject: [PATCH 1/4] Update Synonym to the new version --- src/Index.php | 20 ++++++++++++++------ src/Setup.php | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/Index.php b/src/Index.php index eecffb0..9cfc47a 100644 --- a/src/Index.php +++ b/src/Index.php @@ -587,14 +587,22 @@ public function synonymAdd( array $synonymList = array() ) { return; } - foreach ( $synonymList as $synonym ) { + foreach ( $synonymList as $key => $synonym ) { $synonymGroup = array_map( 'trim', $synonym ); - $synonymCommand = array_merge( array( $this->getIndexName() ), $synonymGroup ); - - $this->client->rawCommand( 'FT.SYNADD', $synonymCommand ); + $synonymCommand = array_merge( array( $this->getIndexName() ), array( "synonymGroup:$key" ), $synonymGroup ); + $this->client->rawCommand( 'FT.SYNUPDATE', $synonymCommand ); } } + /** + * @param + * + * @return void + */ + public function synonymDump() { + $this->client->rawCommand( 'FT.SYNDUMP', array( $this->getIndexName() ) ); + } + /** * @return array */ @@ -702,8 +710,8 @@ public function delete( string $id = NULL ) { return NULL; } - $command = array( $this->indexName, $id, 'DD' ); - $this->client->rawCommand( 'FT.DEL', $command ); + $command = array( $this->indexName, $id ); + $this->client->rawCommand( 'DEL', $command ); return $this; } diff --git a/src/Setup.php b/src/Setup.php index a214921..315e71e 100644 --- a/src/Setup.php +++ b/src/Setup.php @@ -14,7 +14,7 @@ class Setup { * @param null $password * @param int $database * - * @return \FKRediSearch\RedisRaw\RedisRawClientInterface + * @return PredisAdapter */ public static function connect( $server = '127.0.0.1', $port = 6379, $password = null, $database = 0 ) { // Connect to server From dd8a8e456b8682c2ff006dff2ec5b547eae953e8 Mon Sep 17 00:00:00 2001 From: Guy Korland Date: Mon, 22 Feb 2021 13:46:04 +0200 Subject: [PATCH 2/4] Create LICENSE --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e566b85 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Frontkom + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From b7ddab6c63ae9e25768714e70e54d23b0050d4d1 Mon Sep 17 00:00:00 2001 From: c7x43t Date: Sat, 10 Dec 2022 22:49:12 +0100 Subject: [PATCH 3/4] Fixed Undefined array key 1 in Index.php, crashed on WP6.1 + php 8.2 --- src/Index.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Index.php b/src/Index.php index 9cfc47a..9c7f32b 100644 --- a/src/Index.php +++ b/src/Index.php @@ -754,6 +754,8 @@ public function getInfo( string $indexName = NULL ) { private function normalizeInfoArray( array $redisArray ) { $newArray = array(); for ( $i = 0; $i < count( $redisArray ); $i += 2 ) { + $tmp = &$lookup_table[$key]; + if(isset($tmp)){ if ( $redisArray[$i] === 'fields' ) { foreach ( $redisArray[ $i + 1 ] as $field ) { $fieldName = $field[0]; @@ -775,6 +777,7 @@ private function normalizeInfoArray( array $redisArray ) { $newArray[ $redisArray[$i] ] = $this->normalizeInfoArray( $redisArray[$i + 1] ); } } + } return $newArray; } From a14115be6d2b96dfc5f062dcbd8098beda30bf17 Mon Sep 17 00:00:00 2001 From: Eirik Stanghelle Morland Date: Fri, 15 Aug 2025 08:17:15 +0200 Subject: [PATCH 4/4] Fix a PHP notice (#10) --- src/Query/Query.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Query/Query.php b/src/Query/Query.php index 9f015e6..afa6660 100644 --- a/src/Query/Query.php +++ b/src/Query/Query.php @@ -463,7 +463,7 @@ public function searchQueryArgs( $query ) { array_merge( trim($queryWithFilters) === '' ? array( $this->indexName ) : array( $this->indexName, $queryWithFilters ), explode( ' ', $this->limit ), - explode( ' ', $this->slop ), + explode( ' ', $this->slop ?? '' ), array( $this->verbatim, $this->withScores, $this->withSortKey, $this->withPayloads, $this->noStopWords, $this->noContent), explode( ' ', $this->inFields), explode( ' ', $this->inKeys ),