You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**ElasticLens is built from the ground up around Elasticsearch**.
36
+
**ElasticLens is built from the ground up around Elasticsearch**.
37
37
38
-
It integrates directly with the [Laravel-Elasticsearch](https://github.com/pdphilip/laravel-elasticsearch) package (Elasticsearch using Eloquent), creating a dedicated `Index Model` that is fully accessible and automatically synced with your `Base Model`.
38
+
It integrates directly with the [Laravel-Elasticsearch](https://github.com/pdphilip/laravel-elasticsearch) package (Elasticsearch using Eloquent), creating a dedicated `Index Model` that is fully accessible and automatically synced with
39
+
your `Base Model`.
39
40
40
41
<details>
41
42
<summary> How? </summary>
42
43
43
44
44
45
> The `Index Model` acts as a separate Elasticsearch model managed by ElasticLens, yet you retain full control over it, just like any other Laravel model. In addition to working directly with the `Index Model`, ElasticLens offers tools for
45
-
mapping fields (with embedding relationships) during the build process, and managing index migrations.
46
+
> mapping fields (with embedding relationships) during the build process, and managing index migrations.
46
47
47
48
> For Example, a base `User` Model will sync with an Elasticsearch `IndexedUser` Model that provides all the features from [Laravel-Elasticsearch](https://github.com/pdphilip/laravel-elasticsearch) to search your `Base Model`.
48
-
49
+
49
50
</details>
50
51
51
52
---
@@ -80,7 +81,7 @@ Publish the config file and run the migrations with:
80
81
php artisan lens:install
81
82
```
82
83
83
-
# Usage
84
+
# Usage
84
85
85
86
The Walkthrough below will demonstrate all the features by way of an example.
86
87
@@ -99,7 +100,9 @@ class User extends Eloquent implements Authenticatable, CanResetPassword
99
100
```
100
101
101
102
### 2. Create an Index Model for Your Base Model:
102
-
- ElasticLens expects the `Index Model` to be named as `Indexed` + `BaseModelName` and located in the `App\Models\Indexes` directory.
103
+
104
+
- ElasticLens expects the `Index Model` to be named as `Indexed` + `BaseModelName` and located in the `App\Models\Indexes` directory.
105
+
103
106
```php
104
107
/**
105
108
* Create: App\Models\Indexes\IndexedUser.php
@@ -113,10 +116,11 @@ class IndexedUser extends IndexModel{}
113
116
114
117
115
118
```
119
+
116
120
- That's it! Your User model will now automatically sync with the IndexedUser model whenever changes occur. You can search your User model effortlessly, like:
> Searches for the term 'David', boosts the first_name field by 3, last_name by 2, and also checks the bio field. Returns results with a minimum score of 2.1, ordered by the highest score.
181
+
> Searches for the term 'David', boosts the first_name field by 3, last_name by 2, and also checks the bio field. Results are ordered by score.
**Note**: While you can query the `IndexableBuildState` model directly, avoid writing or deleting records within it manually, as this can interfere with the health checks and overall integrity of the indexing process. The model should be used for reading purposes only to ensure accurate monitoring and reporting.
779
+
**Note**: While you can query the `IndexableBuildState` model directly, avoid writing or deleting records within it manually, as this can interfere with the health checks and overall integrity of the indexing process. The model should be
780
+
used for reading purposes only to ensure accurate monitoring and reporting.
771
781
772
782
---
773
783
@@ -790,7 +800,7 @@ ElasticLens includes a built-in `IndexableMigrationLog` model for monitoring and
790
800
-@property-read string `$version`: Parsed version ex v2.03
791
801
-@property-read string `$state_name`: Current state name.
792
802
-@property-read string `$state_color`: Color representing the current state.
**Note**: While you can query the `IndexableMigrationLog` model directly, avoid writing or deleting records within it manually, as this can interfere with versioing of the migrations. The model should be used for reading purposes only to ensure accuracy.
814
+
**Note**: While you can query the `IndexableMigrationLog` model directly, avoid writing or deleting records within it manually, as this can interfere with versioing of the migrations. The model should be used for reading purposes only to
0 commit comments