Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
Elasticsearch DSL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Public
Elasticsearch DSL
Commits
0977acb0
Commit
0977acb0
authored
10 years ago
by
Zigmas Satkevičius
Browse files
Options
Downloads
Patches
Plain Diff
Added cardinality aggregation.
Closes #119.
parent
133e57b7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Aggregation/CardinalityAggregation.php
+95
-0
95 additions, 0 deletions
Aggregation/CardinalityAggregation.php
with
95 additions
and
0 deletions
Aggregation/CardinalityAggregation.php
0 → 100644
+
95
−
0
View file @
0977acb0
<?php
/*
* This file is part of the ONGR package.
*
* (c) NFQ Technologies UAB <info@nfq.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace
ONGR\ElasticsearchBundle\DSL\Aggregation
;
use
ONGR\ElasticsearchBundle\DSL\Aggregation\Type\MetricTrait
;
/**
* Difference values counter.
*/
class
CardinalityAggregation
extends
AbstractAggregation
{
use
MetricTrait
;
/**
* @var int
*/
private
$precisionThreshold
;
/**
* @var bool
*/
private
$rehash
;
/**
* {@inheritdoc}
*/
public
function
getArray
()
{
if
(
!
$this
->
getField
())
{
return
new
\stdClass
();
}
$out
[
'field'
]
=
$this
->
getField
();
if
(
$this
->
getPrecisionThreshold
())
{
$out
[
'precision_threshold'
]
=
$this
->
getPrecisionThreshold
();
}
if
(
$this
->
isRehash
()
!==
null
)
{
$out
[
'rehash'
]
=
$this
->
isRehash
();
}
return
$out
;
}
/**
* Precision threshold.
*
* @param int $precision Precision Threshold.
*/
public
function
setPrecisionThreshold
(
$precision
)
{
$this
->
precisionThreshold
=
$precision
;
}
/**
* @return int
*/
public
function
getPrecisionThreshold
()
{
return
$this
->
precisionThreshold
;
}
/**
* @return bool
*/
public
function
isRehash
()
{
return
$this
->
rehash
;
}
/**
* @param bool $rehash
*/
public
function
setRehash
(
$rehash
)
{
$this
->
rehash
=
$rehash
;
}
/**
* {@inheritdoc}
*/
public
function
getType
()
{
return
'cardinality'
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment