How does laravel scout define multiple indexes?

for example, in a laravel project, one table is product, and the other is article,. I want to use full-text search in all projects, but scout only allows you to define an index, or Synchronize

.

I have seen a lot of cases on the Internet. I hope you can provide ideas

.
Apr.11,2021

I have the same problem. Have you solved it?


to implement multiple model queries, you can change the configured index during model initialization.
for example, when using the ElasticSearch driver, the driver package defaults to taking the configuration value of scout.elasticsearch.index as the index, so by changing this configuration value in the _ _ construct method of the model, you can realize the multi-model query


override the searchableUsing method in the searchAble in the Model to be called, and update the custom index.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e44860-44acc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e44860-44acc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?