Closed nbolender closed 3 months ago
It is also worth noting that since the tntsearch:import
method pulls directly from the database, any custom fields that you add to the array won't be indexed. For example, if you manually create your own ngrams for a field and store it, they will not show up. This got me stuck for awhile. The documentation should be updated to note this or even better, the tntsearch:import
should warn you when it notices you are added columns that aren't in the database. There is definitely a use-case for pulling directly from the db - but the documentation gives the impression that it works the same as scout:import
but just faster.
Just putting this here to maybe encourage someone to update the documentation.
It seems you cannot use tntsearch:import if you use lazy-loading relations in your toSearchableArray() function. Using scout:import works fine. I assume that tntsearch:import goes straight to the database and that's why it's faster, but it makes relations hard to work with.