meilisearch / meilisearch-symfony

Seamless integration of Meilisearch into your Symfony project.
https://www.meilisearch.com
MIT License
126 stars 30 forks source link

I've got "Notice: Undefined index: errorCode" on excecuting bin/console meili:import command #152

Closed 676767ap closed 2 years ago

676767ap commented 2 years ago

On excecuting bin/console meili:import command i've got this:

In HandlesIndex.php line 64:

  Notice: Undefined index: errorCode  

My meili_search.yaml

meili_search:
    indices:
        - name: docs
          class: App\Entity\SearchRes
          enable_serializer_groups: true

SearchRes.php entity:

<?php

namespace App\Entity;
use App\Repository\SearchResRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;

/**
 * @ORM\Entity(repositoryClass=SearchResRepository::class)
 */
class SearchRes
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @ORM\Column(type="text")
     */
    private $title;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private $code;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private $entityType;

    public function getId(): ?int
    {
        return $this->id;
    }

    /**
     * @Groups({"searchable"})
     */
    public function getTitle(): ?string
    {
        return $this->title;
    }

    public function setTitle(string $title): self
    {
        $this->title = $title;

        return $this;
    }

    /**
     * @Groups({"searchable"})
     */
    public function getCode(): ?string
    {
        return $this->code;
    }

    public function setCode(?string $code): self
    {
        $this->code = $code;

        return $this;
    }

    /**
     * @Groups({"searchable"})
     */
    public function getEntityType(): ?string
    {
        return $this->entityType;
    }

    public function setEntityType(?string $entityType): self
    {
        $this->entityType = $entityType;

        return $this;
    }
}

in .env:

MEILISEARCH_URL=http://127.0.0.1:7700
MEILISEARCH_API_KEY=Y0urVery-S3cureAp1K3y

Symfony 4, Ubuntu 21.10, PHP 7.4

curquiza commented 2 years ago

Hello, what are

676767ap commented 2 years ago

"meilisearch/search-bundle": "^0.2.6" "meilisearch/meilisearch-php": "v0.16.0" meilisearch-http 0.24.0

curquiza commented 2 years ago

If you use MeilISearch v0.24.0, please use:

676767ap commented 2 years ago

Thanks a lot! Unfortunately i cannot use those versions due to confilts with other old bundles. I'll try to downgrade MeilISearch itself.

curquiza commented 2 years ago

Which conflict do you have? :(

676767ap commented 2 years ago

Many!)))) With old Sonata-project + Doctrine ORM mostly it unsolvable

composer require meilisearch/search-bundle:0.6.0 --ignore-platform-reqs --with-all-dependencies
The "symfony/flex" plugin was skipped because it is not compatible with Composer 2+. Make sure to update it to version 1.9.8 or greater.
./composer.json has been updated
The "symfony/flex" plugin was skipped because it is not compatible with Composer 2+. Make sure to update it to version 1.9.8 or greater.
Running composer update meilisearch/search-bundle --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - doctrine/orm is locked to version v2.7.3 and an update of this package was not requested.
    - meilisearch/search-bundle v0.6.0 requires doctrine/doctrine-bundle ^2.4 -> satisfiable by doctrine/doctrine-bundle[2.4.0, ..., 2.5.5].
    - doctrine/orm v2.7.3 conflicts with doctrine/doctrine-bundle 2.5.5.
    - doctrine/orm v2.7.3 conflicts with doctrine/doctrine-bundle 2.5.4.
    - doctrine/orm v2.7.3 conflicts with doctrine/doctrine-bundle 2.5.3.
    - doctrine/orm v2.7.3 conflicts with doctrine/doctrine-bundle 2.5.2.
    - doctrine/orm v2.7.3 conflicts with doctrine/doctrine-bundle 2.5.1.
    - doctrine/orm v2.7.3 conflicts with doctrine/doctrine-bundle 2.5.0.
    - doctrine/orm v2.7.3 conflicts with doctrine/doctrine-bundle 2.4.4.
    - doctrine/orm v2.7.3 conflicts with doctrine/doctrine-bundle 2.4.3.
    - doctrine/orm v2.7.3 conflicts with doctrine/doctrine-bundle 2.4.2.
    - doctrine/orm v2.7.3 conflicts with doctrine/doctrine-bundle 2.4.1.
    - doctrine/orm v2.7.3 conflicts with doctrine/doctrine-bundle 2.4.0.
    - Root composer.json requires meilisearch/search-bundle 0.6.0 -> satisfiable by meilisearch/search-bundle[v0.6.0].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

and at last

composer require doctrine/orm:2.9.0 --ignore-platform-reqs --with-all-dependencies
The "symfony/flex" plugin was skipped because it is not compatible with Composer 2+. Make sure to update it to version 1.9.8 or greater.
./composer.json has been updated
The "symfony/flex" plugin was skipped because it is not compatible with Composer 2+. Make sure to update it to version 1.9.8 or greater.
Running composer update doctrine/orm --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires doctrine/orm 2.9.0 -> satisfiable by doctrine/orm[2.9.0].
    - Conclusion: don't install doctrine/persistence 1.3.8 (conflict analysis result)
    - Conclusion: don't install doctrine/persistence 2.2.2 (conflict analysis result)
    - Conclusion: don't install doctrine/persistence 2.2.3 (conflict analysis result)
    - Conclusion: don't install doctrine/persistence 2.2.4 (conflict analysis result)
    - Conclusion: don't install doctrine/persistence 2.3.0 (conflict analysis result)
    - sonata-project/doctrine-orm-admin-bundle is locked to version 3.18.0 and an update of this package was not requested.
    - sonata-project/doctrine-orm-admin-bundle 3.18.0 requires doctrine/persistence ^1.3.4 -> satisfiable by doctrine/persistence[1.3.4, ..., 1.3.8].
    - You can only install one version of a package, so only one of these can be installed: doctrine/persistence[v1.0.0, ..., 1.3.8, 2.0.0, ..., 2.3.0].
    - doctrine/orm 2.9.0 requires doctrine/persistence ^2.2 -> satisfiable by doctrine/persistence[2.2.0, ..., 2.3.0].
    - Conclusion: don't install doctrine/persistence 2.2.1 (conflict analysis result)
676767ap commented 2 years ago

Could you please tell me what version of meilisearch will work with "meilisearch/search-bundle": "^0.2.6" and "meilisearch/meilisearch-php": "v0.16.0" ?

curquiza commented 2 years ago

I would say MeiliSearch v0.20.0 or older... Do we have a too old (or too new?) doctrine-bundle dependency in our composer.json?

brunoocasali commented 2 years ago

@676767ap and @curquiza I had this exact same problem when I was trying this bundle.

My problem was regarding my Meilisearch server version being too much up to date (v0.26.1) using an old search-bundle, and meilisearch-php.

So, @676767ap I think your problem will be solved by doing what @curquiza said, updating all or downgrading all. I'll close this issue, but feel free to open new ones!

Thanks a lot for using Meilisearch ❤️