Skip to content
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

SignificantTerms aggregation #847

Merged
merged 1 commit into from
May 17, 2015

Conversation

rmruano
Copy link
Contributor

@rmruano rmruano commented May 17, 2015

SignificantTerms aggregation is almost identical to Terms Aggregation. Extended it and added a convenience method for setting a background filter. Simple tests added, although they may not be very good examples: SignificantTerms doesn't shine on automatically generated datasets.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 91065a6 on miniplay:significant-terms-aggregation into * on ruflin:master*.

* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-significantterms-aggregation.html#_custom_background_context
*/
public function setBackgroundFilter(AbstractQuery $query) {
$this->setParam("background_filter", $query->toArray());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed return statement. All setters must implement fluent interface.

@im-denisenko
Copy link
Contributor

@rmruano Could you look into my eyes and say that every existing parameter of Terms aggregation can be applied to SignificantTerms? If it's not, class should be extended from AbstractSimpleAggregation.

* @param AbstractQuery $query
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-significantterms-aggregation.html#_custom_background_context
*/
public function setBackgroundFilter(AbstractQuery $query) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to parameter name, shouldn't here be AbstractFilter indeed?

@rmruano rmruano force-pushed the significant-terms-aggregation branch from 91065a6 to c48da91 Compare May 17, 2015 15:18
@rmruano
Copy link
Contributor Author

rmruano commented May 17, 2015

@im-denisenko Thanks for your feedback. Apparently, the only missing feature is order, to overcome this without duplicating code, I've created a common AstractTermsAggregation that both Terms & SignificantTerms extend. Please take a look and let me know if you're ok with it.

I've also fixed SignificantTerms::setBackgroundFilter() with your suggestions.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling c48da91 on miniplay:significant-terms-aggregation into * on ruflin:master*.

@im-denisenko im-denisenko merged commit c48da91 into ruflin:master May 17, 2015
@im-denisenko
Copy link
Contributor

Merged, thanks!

im-denisenko added a commit to im-denisenko/Elastica that referenced this pull request May 17, 2015
im-denisenko added a commit to im-denisenko/Elastica that referenced this pull request May 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants