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

Fallback not worked #122

@coolycow

Description

@coolycow

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions