Figured I’d put an update here about merging Abdul...
# contributions
h
Figured I’d put an update here about merging Abdullah’s latest Laravel Scout updates into the Typesense org. I’m almost finished, going to continue debugging an issue with document deletion tomorrow and then I’ll release an RC! cc @Jason Bosco
j
Sounds good! Thank you @hi019!
👍 1
h
@Abdullah Al-Faqeir not sure if you watch this slack, but do you know why I would be getting
Typesense\Exceptions\ObjectNotFound
when trying to delete this model?
Copy code
class Todo extends Model implements TypesenseSearch
{
    use HasFactory, Searchable;

    public function typesenseQueryBy(): array
    {
        return ['name'];
    }

    public function getCollectionSchema(): array {
        return [
            'name' => $this->searchableAs(),
            'fields' => [
                [
                    'name' => 'id',
                    'type' => 'string',
                ],
                [
                    'name' => 'name',
                    'type' => 'string',
                ],
                [
                    'name' => 'created_at',
                    'type' => 'int64',
                ],
            ],
            'default_sorting_field' => 'created_at',
        ];
    }

    public function toSearchableArray()
    {
        return $this->toArray();
    }
}
It’s in a new Laravel 8 project and the document is being indexed on create correctly. The error is being thrown here (where is
$collectionIndex->getDocuments()->documents
being initialized?) https://github.com/devloopsnet/laravel-scout-typesense-engine/blob/50b60022605372b4b9eed0322d35335c9fd3d2e6/src/Typesense.php#L127
a
When calling toArray() inside toSearchableArray(), it won't actually index the document as the id will be sent as an integer while it's defined as a string, so I suggest you create the array yourself inside toSearchableArray() handling the fields and the types casting
h
Ah, got it
👍 1
I’ve just merged Abdullah’s changes and released v5.0.1-rc3
😇 1
a
By the way, @Jason Bosco my invitation to the repo got expired, if you please send me another one
j
@Abdullah Al-Faqeir I just added you again. You'd need to accept the invite here: https://github.com/typesense/laravel-scout-typesense-driver/invitations
a
Just did, proud to be part of all that, And more proud that I had the honour to start it
🙌 1