-
-
Notifications
You must be signed in to change notification settings - Fork 253
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
Allow for explain to be set on a query #119
Conversation
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.
change looks good except phpdoc annotations. Could you also write a small test that uses this feature?
@@ -193,6 +193,14 @@ public function getHighlight() | |||
} | |||
|
|||
/** | |||
* @return array|null An explanation for each hit on how its score was computed | |||
*/ |
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.
need @since 2.0.5
annotation.
/** | ||
* @var Enables explanation for each hit on how its score was computed. | ||
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-explain.html | ||
*/ |
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.
need @since 2.0.5
annotation.
* @param $explain | ||
* @return $this | ||
* @see $explain | ||
*/ |
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.
need @since 2.0.5
annotation.
@cebe Okay I have updated the annotations and added in two simple test cases to check for the existence of |
looks good to me, thanks! If you add a CHANGLOG line I'll merge it right away. |
@@ -171,6 +171,12 @@ class Query extends Component implements QueryInterface | |||
* @since 2.0.4 | |||
*/ | |||
public $options = []; | |||
/** | |||
* @var Enables explanation for each hit on how its score was computed. |
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.
oh, missed that. this should include the type: @var bool
|
||
/** | ||
* Explain for how the score of each document was computer | ||
* @param $explain |
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.
same here: @param bool $explain
Done and not a problem! |
Merged, thank you! |
Allow for explain to be set on a query, so you can see how the score for a certain document is calculated.
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html
Can be used by
ElasticActiveRecord::find()->query(...)->explain(true)->all();
.