Skip to content

Typesense Driver - Call to a member function retrieve() on array #896

@Thiritin

Description

@Thiritin

Scout Version

10.11.9

Scout Driver

Typesense

Laravel Version

11.9

PHP Version

8.4.1

Database Driver & Version

No response

SDK Version

4.9

Meilisearch CLI Version

No response

Description

Issue with the typesense driver, a collection named "collections" i.e. for a store system. Will cause an unhandled exception to be thrown.

in the getOrCreateCollectionFromModel Method from the TypesenseEngine it will try to check if the collection exists by calling this piece of code $this->typesense->getCollections()->{$collectionName};

The Problem is that the ->getCollections has a property called collections, this is accessible trough the __get method so it will return as an empty array.

image

Here is the Code in the TypesenseEngine with some Comments made by me to show the values and to explain what is going on.

image

Exception caused.

Call to a member function retrieve() on array

The issue is resolved when using another name other than collections. I am creating this issue to bring it to the attention of the developers, and most importantly, save some people some time when encountering this issue.

Steps To Reproduce

Create a new laravel project, install scout and create a model called Collection.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions