-
-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EloquentHitsIteratorAggregate trait for properties. #281
Conversation
…light out of EloquentHitsIteratorAggregate without implementing your own class.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 8.x #281 +/- ##
======================================
Coverage ? 98.16%
Complexity ? 266
======================================
Files ? 41
Lines ? 816
Branches ? 0
======================================
Hits ? 801
Misses ? 15
Partials ? 0 ☔ View full report in Codecov by Sentry. |
/** @var Model&Searchable&ElasticParams $model */ | ||
$model = $models[$key]; | ||
|
||
if (isset($hit['_score']) && ! empty($hit['_score']) && method_exists($model, 'setElasticsearchScore')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer that we would call method_exists once for each model type. Not a blocker just possible improvement
On comment with possible improvement(up to you) |
Updated README.md and CHANGELOG.md to include this change. |
CHANGELOG.md
Outdated
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/) | |||
### Added | |||
- fromScope, uses forPageAfterId. | |||
- a new option "--parallel" for ImportCommand, can only be used with [Trackable-Jobs](https://github.com/mateusjunges/trackable-jobs-for-laravel) package currently. | |||
- ElasticParams trait, that adds 'getElasticsearchScore' and 'getElasticsearchHighlight' to the model after performing a search. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be a new version
8.0.0-alpha.2
or if you want to have it in stable, you should to create a PR on top of master branch
then it will be 7.7.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated Changelog.md
Added a trait, that sets _score and highlight from EloquentHitsIteratorAggregate.
After adding the trait to your model, you can access '_score' and 'highlight' after a search was performed via 'getElasticsearchScore' and 'getElasticsearchHighlight' functions.
Any feedback appreciated.