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

[Laravel] Integrate support for Laravel Scout #148

Open
alexander-schranz opened this issue Apr 3, 2023 · 0 comments
Open

[Laravel] Integrate support for Laravel Scout #148

alexander-schranz opened this issue Apr 3, 2023 · 0 comments
Labels
features New feature or request Integration: Laravel Laravel related issue

Comments

@alexander-schranz
Copy link
Member

alexander-schranz commented Apr 3, 2023

Add support for Laravel Scout by providing a bridge to it.

This maybe would allow that laravel scout can use any search engines which is supported by SEAL without having to implement the search engines by there own.

Differences between Laravel Scout vs SEAL

The main difference between Laravel Scout and SEAL is that in Laravel Scout the mapping, field configuration, ... is optional and there exists not an abstraction around it. So if you have searchable, filterable, ... fields that definitions are not defined in an abstract way instead they requires to be defined inside a specific meilisearch configuration: https://laravel.com/docs/10.x/scout#configuring-filterable-data-for-meilisearch.

So the most difficult part to have a seemless integration of SEAL Adapter into Laravel Scout would be that project using the SEAL adapter requires still defining the mapping.

There are 2 options where the mapping could be defined.

Solution A

It is configured inside a configuration file which entity mapped to which SEAL schema e.g.:

'schranz_search' => [
    'laravel_scout' => [
        User::class => 'user_index_name',
        Flight::class => 'user_index_name',
    ],
],

Solution B

We introduce a new kind of metadata loader which alloes to definition of the mapping on Laravel Eloquent Model itself e.g.:

class User extends Model implements SealModelInterface
{
    use Searchable;
    
    public static function getSealIndex(): Index
    {
        return new Index('blog', [
            'title' => new Field\TextField('title', sortable: true),
            'tags' => new Field\TextField('tags', multiple: true, filterable: true),
        ]);
    }
}
@alexander-schranz alexander-schranz added features New feature or request Integration: Laravel Laravel related issue labels Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
features New feature or request Integration: Laravel Laravel related issue
Projects
None yet
Development

No branches or pull requests

1 participant