Coder Social home page Coder Social logo

Scout 9 about laravel-scout-postgres HOT 4 OPEN

pmatseykanets avatar pmatseykanets commented on August 14, 2024 4
Scout 9

from laravel-scout-postgres.

Comments (4)

AlbinoDrought avatar AlbinoDrought commented on August 14, 2024 1

If you don't care about new Scout 9 features and just want to upgrade, this patch implements stubs for the new Scout 9 methods:

From 91743119444f97a6f289e17827cfc8309f51d1cd Mon Sep 17 00:00:00 2001
From: AlbinoDrought <snip>
Date: Fri, 5 Aug 2022 07:38:13 -0700
Subject: [PATCH] feat: Laravel 9 support

---
 composer.json          | 10 +++++-----
 src/PostgresEngine.php | 21 +++++++++++++++++++--
 2 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/composer.json b/composer.json
index 305a86c..5007ed1 100644
--- a/composer.json
+++ b/composer.json
@@ -23,11 +23,11 @@
         }
     ],
     "require": {
-        "php": "^7.2|^8.0",
-        "illuminate/contracts": "~6.0|~7.0|~8.0",
-        "illuminate/database": "~6.0|~7.0|~8.0",
-        "illuminate/support": "~6.0|~7.0|~8.0",
-        "laravel/scout": "~7.0|~8.0"
+        "php": "^8.0",
+        "illuminate/contracts": "^9.0",
+        "illuminate/database": "^9.0",
+        "illuminate/support": "^9.0",
+        "laravel/scout": "^9.0"
     },
     "require-dev": {
         "phpunit/phpunit": "^8.3",
diff --git a/src/PostgresEngine.php b/src/PostgresEngine.php
index b92b3e0..8504090 100644
--- a/src/PostgresEngine.php
+++ b/src/PostgresEngine.php
@@ -6,6 +6,7 @@ use Illuminate\Database\ConnectionResolverInterface;
 use Illuminate\Database\Eloquent\Collection;
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Support\Arr;
+use Illuminate\Support\LazyCollection;
 use Laravel\Scout\Builder;
 use Laravel\Scout\Engines\Engine;
 use ScoutEngines\Postgres\TsQuery\PhraseToTsQuery;
@@ -75,7 +76,6 @@ class PostgresEngine extends Engine
      * Perform update of the given model.
      *
      * @param \Illuminate\Database\Eloquent\Model $model
-     * @return bool
      */
     protected function performUpdate(Model $model)
     {
@@ -339,6 +339,24 @@ class PostgresEngine extends Engine
             });
     }
 
+    public function lazyMap(Builder $builder, $results, $model)
+    {
+        // not supported
+        return new LazyCollection(
+            $this->map($builder, $results, $model)
+        );
+    }
+
+    public function createIndex($name, array $options = [])
+    {
+        return null;
+    }
+
+    public function deleteIndex($name)
+    {
+        return null;
+    }
+
     /**
      * Connect to the database.
      */
@@ -389,7 +407,6 @@ class PostgresEngine extends Engine
      * Get rank function.
      *
      * @param \Illuminate\Database\Eloquent\Model $model
-     * @return int
      */
     protected function rankFunction(Model $model)
     {
-- 
2.37.1

(the changed PHPDoc is due to Psalm complaints, rankFunction actually returns string, performUpdate actually returns int|bool)

from laravel-scout-postgres.

devNoiseConsulting avatar devNoiseConsulting commented on August 14, 2024

Would like to 2nd this question/issue. Laravel 8 is going to stop getting bug fixes next week (July 26, 2022). This package is useful to me and would like to continue using it in the newer versions of Laravel.

from laravel-scout-postgres.

AlbinoDrought avatar AlbinoDrought commented on August 14, 2024

Following the above patch to Scout 9, the BC-break changes in Laravel 10 and Scout 10 do not impact this package:

From da73332097fbff3a694f3fb7d0a08e01a78066be Mon Sep 17 00:00:00 2001
From: AlbinoDrought <snip>
Date: Thu, 16 Mar 2023 11:15:06 -0700
Subject: [PATCH] feat: Laravel 10, Scout 10 support

---
 composer.json | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/composer.json b/composer.json
index 5007ed1..6146c4f 100644
--- a/composer.json
+++ b/composer.json
@@ -24,10 +24,10 @@
     ],
     "require": {
         "php": "^8.0",
-        "illuminate/contracts": "^9.0",
-        "illuminate/database": "^9.0",
-        "illuminate/support": "^9.0",
-        "laravel/scout": "^9.0"
+        "illuminate/contracts": "^10.0 || ^9.0",
+        "illuminate/database": "^10.0 || ^9.0",
+        "illuminate/support": "^10.0 || ^9.0",
+        "laravel/scout": "^10.0 || ^9.0"
     },
     "require-dev": {
         "phpunit/phpunit": "^8.3",
-- 
2.38.1

from laravel-scout-postgres.

devNoiseConsulting avatar devNoiseConsulting commented on August 14, 2024

@AlbinoDrought I've not seen any responses or updates, I've forked this project and am trying to update/maintain the driver.

from laravel-scout-postgres.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.