![]() However, the collection engine does not utilize full text indexes or LIKE clauses to find matching records. They both interact directly with your database to retrieve search results. On first glance, the "database" and "collections" engines are fairly similar. Search engine indexing, such as the indexing needed to seed Algolia or Meilisearch indexes, is unnecessary when using the collection engine. Once you have specified the collection driver as your preferred driver, you may start executing search queries against your models. ![]() Any columns that are not assigned additional search strategy behavior will continue to use the default "where like" strategy: To define this behavior, you may assign PHP attributes to your model's toSearchableArray method. ![]() Therefore, the database engine's search strategy can be configured so that some specified columns utilize full text search queries or only use "where like" constraints to search the prefixes of strings ( example%) instead of searching within the entire string ( %example%). However, in some situations, this may result in poor performance. Customizing Database Searching Strategiesīy default, the database engine will execute a "where like" query against every model attribute that you have configured as searchable. Search engine indexing, such as the indexing needed to seed Algolia or Meilisearch indexes, is unnecessary when using the database engine. Then, you may start executing search queries against your models. Once you have specified the database engine as your preferred driver, you must configure your searchable data. Furthermore, writing custom drivers is simple and you are free to extend Scout with your own search implementations.įirst, install Scout via the Composer package manager: In addition, Scout includes a "collection" driver that is designed for local development usage and does not require any external dependencies or third-party services. Using model observers, Scout will automatically keep your search indexes in sync with your Eloquent records.Ĭurrently, Scout ships with Algolia, Meilisearch, and MySQL / PostgreSQL ( database) drivers. Laravel Scout provides a simple, driver based solution for adding full-text search to your Eloquent models. Conditionally Searchable Model Instances. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |