Skip to content

Commit d5d6273

Browse files
committed
feat: add scout and typesense config
1 parent e42ae6e commit d5d6273

3 files changed

Lines changed: 198 additions & 0 deletions

File tree

.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,11 @@ VITE_APP_NAME="${APP_NAME}"
6868
TELESCOPE_ENABLED=false
6969
TELESCOPE_DARK_THEME=true
7070

71+
SCOUT_DRIVER=typesense
72+
SCOUT_QUEUE=true
73+
74+
TYPESENSE_API_KEY=abc
75+
TYPESENSE_HOST=typesense
76+
7177
ECLIPSE_EMAIL_VERIFICATION=false
7278
PHPMYADMIN_URL="https://pma.eclipse-app.lndo.site/"

.lando.dist.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ services:
3939
- database
4040
database:
4141
type: mariadb:10.11
42+
typesense:
43+
type: typesense:28.0
44+
portforward: 8108
45+
apiKey: abc
4246
proxy:
4347
pma:
4448
- pma.eclipse-app.lndo.site

config/scout.php

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Default Search Engine
8+
|--------------------------------------------------------------------------
9+
|
10+
| This option controls the default search connection that gets used while
11+
| using Laravel Scout. This connection is used when syncing all models
12+
| to the search service. You should adjust this based on your needs.
13+
|
14+
| Supported: "algolia", "meilisearch", "typesense",
15+
| "database", "collection", "null"
16+
|
17+
*/
18+
19+
'driver' => env('SCOUT_DRIVER', 'algolia'),
20+
21+
/*
22+
|--------------------------------------------------------------------------
23+
| Index Prefix
24+
|--------------------------------------------------------------------------
25+
|
26+
| Here you may specify a prefix that will be applied to all search index
27+
| names used by Scout. This prefix may be useful if you have multiple
28+
| "tenants" or applications sharing the same search infrastructure.
29+
|
30+
*/
31+
32+
'prefix' => env('SCOUT_PREFIX', ''),
33+
34+
/*
35+
|--------------------------------------------------------------------------
36+
| Queue Data Syncing
37+
|--------------------------------------------------------------------------
38+
|
39+
| This option allows you to control if the operations that sync your data
40+
| with your search engines are queued. When this is set to "true" then
41+
| all automatic data syncing will get queued for better performance.
42+
|
43+
*/
44+
45+
'queue' => env('SCOUT_QUEUE', false),
46+
47+
/*
48+
|--------------------------------------------------------------------------
49+
| Database Transactions
50+
|--------------------------------------------------------------------------
51+
|
52+
| This configuration option determines if your data will only be synced
53+
| with your search indexes after every open database transaction has
54+
| been committed, thus preventing any discarded data from syncing.
55+
|
56+
*/
57+
58+
'after_commit' => true,
59+
60+
/*
61+
|--------------------------------------------------------------------------
62+
| Chunk Sizes
63+
|--------------------------------------------------------------------------
64+
|
65+
| These options allow you to control the maximum chunk size when you are
66+
| mass importing data into the search engine. This allows you to fine
67+
| tune each of these chunk sizes based on the power of the servers.
68+
|
69+
*/
70+
71+
'chunk' => [
72+
'searchable' => 500,
73+
'unsearchable' => 500,
74+
],
75+
76+
/*
77+
|--------------------------------------------------------------------------
78+
| Soft Deletes
79+
|--------------------------------------------------------------------------
80+
|
81+
| This option allows to control whether to keep soft deleted records in
82+
| the search indexes. Maintaining soft deleted records can be useful
83+
| if your application still needs to search for the records later.
84+
|
85+
*/
86+
87+
'soft_delete' => true,
88+
89+
/*
90+
|--------------------------------------------------------------------------
91+
| Identify User
92+
|--------------------------------------------------------------------------
93+
|
94+
| This option allows you to control whether to notify the search engine
95+
| of the user performing the search. This is sometimes useful if the
96+
| engine supports any analytics based on this application's users.
97+
|
98+
| Supported engines: "algolia"
99+
|
100+
*/
101+
102+
'identify' => env('SCOUT_IDENTIFY', false),
103+
104+
/*
105+
|--------------------------------------------------------------------------
106+
| Algolia Configuration
107+
|--------------------------------------------------------------------------
108+
|
109+
| Here you may configure your Algolia settings. Algolia is a cloud hosted
110+
| search engine which works great with Scout out of the box. Just plug
111+
| in your application ID and admin API key to get started searching.
112+
|
113+
*/
114+
115+
'algolia' => [
116+
'id' => env('ALGOLIA_APP_ID', ''),
117+
'secret' => env('ALGOLIA_SECRET', ''),
118+
'index-settings' => [
119+
// 'users' => [
120+
// 'searchableAttributes' => ['id', 'name', 'email'],
121+
// 'attributesForFaceting'=> ['filterOnly(email)'],
122+
// ],
123+
],
124+
],
125+
126+
/*
127+
|--------------------------------------------------------------------------
128+
| Meilisearch Configuration
129+
|--------------------------------------------------------------------------
130+
|
131+
| Here you may configure your Meilisearch settings. Meilisearch is an open
132+
| source search engine with minimal configuration. Below, you can state
133+
| the host and key information for your own Meilisearch installation.
134+
|
135+
| See: https://www.meilisearch.com/docs/learn/configuration/instance_options#all-instance-options
136+
|
137+
*/
138+
139+
'meilisearch' => [
140+
'host' => env('MEILISEARCH_HOST', 'http://localhost:7700'),
141+
'key' => env('MEILISEARCH_KEY'),
142+
'index-settings' => [
143+
// 'users' => [
144+
// 'filterableAttributes'=> ['id', 'name', 'email'],
145+
// ],
146+
],
147+
],
148+
149+
/*
150+
|--------------------------------------------------------------------------
151+
| Typesense Configuration
152+
|--------------------------------------------------------------------------
153+
|
154+
| Here you may configure your Typesense settings. Typesense is an open
155+
| source search engine using minimal configuration. Below, you will
156+
| state the host, key, and schema configuration for the instance.
157+
|
158+
*/
159+
160+
'typesense' => [
161+
'client-settings' => [
162+
'api_key' => env('TYPESENSE_API_KEY', 'xyz'),
163+
'nodes' => [
164+
[
165+
'host' => env('TYPESENSE_HOST', 'localhost'),
166+
'port' => env('TYPESENSE_PORT', '8108'),
167+
'path' => env('TYPESENSE_PATH', ''),
168+
'protocol' => env('TYPESENSE_PROTOCOL', 'http'),
169+
],
170+
],
171+
'nearest_node' => [
172+
'host' => env('TYPESENSE_HOST', 'localhost'),
173+
'port' => env('TYPESENSE_PORT', '8108'),
174+
'path' => env('TYPESENSE_PATH', ''),
175+
'protocol' => env('TYPESENSE_PROTOCOL', 'http'),
176+
],
177+
'connection_timeout_seconds' => env('TYPESENSE_CONNECTION_TIMEOUT_SECONDS', 2),
178+
'healthcheck_interval_seconds' => env('TYPESENSE_HEALTHCHECK_INTERVAL_SECONDS', 30),
179+
'num_retries' => env('TYPESENSE_NUM_RETRIES', 3),
180+
'retry_interval_seconds' => env('TYPESENSE_RETRY_INTERVAL_SECONDS', 1),
181+
],
182+
// 'max_total_results' => env('TYPESENSE_MAX_TOTAL_RESULTS', 1000),
183+
'model-settings' => [
184+
//
185+
],
186+
],
187+
188+
];

0 commit comments

Comments
 (0)