Skip to content
GitLab
Explore
Sign in
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
f6a1d030
Unverified
Commit
f6a1d030
authored
6 years ago
by
Simonas Šerlinskas
Browse files
Options
Downloads
Patches
Plain Diff
add significant text aggregation
parent
1a7701f5
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Aggregation/Bucketing/SignificantTextAggregation.php
+28
-0
28 additions, 0 deletions
src/Aggregation/Bucketing/SignificantTextAggregation.php
tests/Unit/Aggregation/Bucketing/SignificantTextAggregationTest.php
+45
-0
45 additions, 0 deletions
.../Aggregation/Bucketing/SignificantTextAggregationTest.php
with
73 additions
and
0 deletions
src/Aggregation/Bucketing/SignificantTextAggregation.php
0 → 100644
+
28
−
0
View file @
f6a1d030
<?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\ElasticsearchDSL\Aggregation\Bucketing
;
/**
* Class representing TermsAggregation.
*
* @link https://goo.gl/xI7zoa
*/
class
SignificantTextAggregation
extends
TermsAggregation
{
/**
* {@inheritdoc}
*/
public
function
getType
()
{
return
'significant_text'
;
}
}
This diff is collapsed.
Click to expand it.
tests/Unit/Aggregation/Bucketing/SignificantTextAggregationTest.php
0 → 100644
+
45
−
0
View file @
f6a1d030
<?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\ElasticsearchDSL\Tests\Unit\Bucketing\Aggregation
;
use
ONGR\ElasticsearchDSL\Aggregation\Bucketing\SignificantTextAggregation
;
/**
* Unit test for children aggregation.
*/
class
SignificantTextAggregationTest
extends
\PHPUnit\Framework\TestCase
{
/**
* Tests getType method.
*/
public
function
testSignificantTextAggregationGetType
()
{
$aggregation
=
new
SignificantTextAggregation
(
'foo'
);
$result
=
$aggregation
->
getType
();
$this
->
assertEquals
(
'significant_text'
,
$result
);
}
/**
* Tests getArray method.
*/
public
function
testSignificantTermsAggregationGetArray
()
{
$mock
=
$this
->
getMockBuilder
(
'ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation'
)
->
disableOriginalConstructor
()
->
getMockForAbstractClass
();
$aggregation
=
new
SignificantTextAggregation
(
'foo'
,
'title'
);
$aggregation
->
addAggregation
(
$mock
);
$result
=
$aggregation
->
getArray
();
$expected
=
[
'field'
=>
'title'
];
$this
->
assertEquals
(
$expected
,
$result
);
}
}
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