Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

Fallback not worked #122

Open
coolycow opened this issue Jun 15, 2021 · 0 comments
Open

Fallback not worked #122

coolycow opened this issue Jun 15, 2021 · 0 comments

Comments

@coolycow
Copy link

Hi!

If I understand correctly, then Fallback will not work.

My config:

'mysql' => [
        'mode' => 'NATURAL_LANGUAGE',
        'model_directories' => [app_path() . '/Models'],
        'min_search_length' => 3,
        'min_fulltext_search_length' => 4,
        'min_fulltext_search_fallback' => 'LIKE_EXPANDED',
        'query_expansion' => false
    ]

I am trying to find a match on two characters and I am getting an empty result.

If I understood everything correctly, then the problem occurs because of this code: (src/Engines/MySQLEngine.php):

public function search(Builder $builder)
{
    $result = [];

    if ($this->shouldNotRun($builder)) {
        $result['results'] = Collection::make();
        $result['count'] = 0;

        return $result;
    }

...
}

protected function shouldNotRun($builder)
{
    return strlen($builder->query) < config('scout.mysql.min_search_length');
}

There is no check that the mode is used, in which the search should be switched to another mode if the number of characters is less than necessary.

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

No branches or pull requests

1 participant