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

Integrate Scout with Laravel JSON:API? #449

Closed
mortezaf opened this issue Nov 4, 2019 · 4 comments
Closed

Integrate Scout with Laravel JSON:API? #449

mortezaf opened this issue Nov 4, 2019 · 4 comments
Labels

Comments

@mortezaf
Copy link

mortezaf commented Nov 4, 2019

Hi
Is there a way to integrate Scout with Laravel JSON:API?

@lindyhopchris
Copy link
Member

Hi! Can you not just use the search method within your JSON API Adapter's filter() method? I've never used Scout so not sure what else you would need to integrate it?

@lindyhopchris
Copy link
Member

Closing due to lack of activity.

@cdubz
Copy link

cdubz commented Feb 21, 2021

👋 I'm looking to do the same thing. Scout provides fulltext indexing and has it's own builder so I don't think there is a way to use the adapter's filter() method. It seems that essentially the query itself needs to be replaced? This is what Scout's Searchable trait provides:

/**
 * Perform a search against the model's indexed data.
 *
 * @param  string  $query
 * @param  \Closure  $callback
 * @return \Laravel\Scout\Builder
 */
public static function search($query = '', $callback = null)
{
    return app(Builder::class, [
        'model' => new static,
        'query' => $query,
        'callback' => $callback,
        'softDelete'=> static::usesSoftDelete() && config('scout.soft_delete', false),
    ]);
}

@lindyhopchris
Copy link
Member

@cdubz I've created an issue in the latest package for this, as I think I'll stand a better chance of getting it integrated in that package. This issue is linked above.

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

No branches or pull requests

3 participants