Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to undefined method getUnqualifiedScoutKeyName() #710

Closed
G33RY opened this issue Mar 4, 2023 · 1 comment
Closed

Call to undefined method getUnqualifiedScoutKeyName() #710

G33RY opened this issue Mar 4, 2023 · 1 comment

Comments

@G33RY
Copy link

G33RY commented Mar 4, 2023

  • Scout Version: 10.0.0
  • Scout Driver: Meilisearch
  • Laravel Version: 10.0.2
  • PHP Version: 8.1.12
  • Database Driver & Version: mysql
  • Meilisearch CLI Version (If using Meilisearch): 1.0.2

Description:

The search works great when I am using simple characters, but if I use some special characters like "~", "-", "." I get this error:

Call to undefined method App\\Models\\Image::getUnqualifiedScoutKeyName() at vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:71)

Steps To Reproduce:

I have a model named Image that has the Searchable trait, and toSearchableArray method:

public function toSearchableArray(): array
{
        return [
            'id'   => $this->getKey(),
            'slug' => $this->slug,
            'type' => $this->type,
            'keywords' => $this->keywords,
            'is_visible' => $this->is_visible,
            'labels' => $this->getLabelsAttribute(),
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
        ];
}

scout.php:

[
   'soft_delete' => true,
   'queue'  => true,
   'after_commit' => true,
   'meilisearch' => [
        'host' => 'http://localhost:7700',
        'key' => '',
        'index-settings' => [
             'images' => [
                 'filterableAttributes'=> ['labels', 'keywords', 'slug', 'type'],
                 'sortableAttributes' => ['created_at', "updated_at"],
             ],
        ],
    ],
]

ImageController

public function index() 
{
    $search = request('search'); //If this is "." or some special character it throws that error 
    return Image::search($search)->get()->all();
}

@driesvints
Copy link
Member

Thanks, this is resolved now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants