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

Cache full text index fields #110

Open
thekonz opened this issue Aug 14, 2020 · 2 comments
Open

Cache full text index fields #110

thekonz opened this issue Aug 14, 2020 · 2 comments

Comments

@thekonz
Copy link
Contributor

thekonz commented Aug 14, 2020

I saw that this package added a lot of queries to my application and at the part that adds the queries, you can see a comment @TODO cache this..

Same thing in the getAllFields method.

I suggest adding a command scout:mysql-cache.

Is there anything preventing us from caching? Otherwise I'll gladly add a PR.

@thewebartisan7
Copy link

If I understand this extra sql query check if column support fulltext search.
I think this check should not even be required but only use toSearchableArray()
Is developer's responsibility to make sure that full text search has been created correctly.
Maybe just add an extra toSearchableFulltextArray() which will be only columns that are "full textable"

@thewebartisan7
Copy link

thewebartisan7 commented Sep 21, 2020

I check into code a bit more and seem that this extra query is executed for select and where, because we can't access toSearchableArray().

A possible workaround could be to add a static method or property into model with array of columns searchable and one fulltextable if different from searchable.

Then in ModelService change method:

    public function getFullTextIndexFields()
    {
        return $this->model::$fulltextable;
    }

    public function getSearchableFields()
    {
        return $this->model::$searchable;
    }

And we could also access directly from builder using $builder->model::$searchable

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

2 participants