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
97292a78
Commit
97292a78
authored
9 years ago
by
Martynas Sudintas
Browse files
Options
Downloads
Plain Diff
Merge pull request #282 from chyzas/patch-dsl-queries
Renamed FuzzyLikeThisFieldQuery
parents
445693f8
f2d9b564
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Query/DisMaxQuery.php
+16
-12
16 additions, 12 deletions
Query/DisMaxQuery.php
Query/FuzzyLikeThisFieldQuery.php
+1
-7
1 addition, 7 deletions
Query/FuzzyLikeThisFieldQuery.php
Query/MultiMatchQuery.php
+11
-2
11 additions, 2 deletions
Query/MultiMatchQuery.php
with
28 additions
and
21 deletions
Query/DisMaxQuery.php
+
16
−
12
View file @
97292a78
...
...
@@ -29,23 +29,27 @@ class DisMaxQuery implements BuilderInterface
/**
* Initializes Dis Max query.
*
* @param BuilderInterface[] $queries
* @param array $parameters
*
* @throws \InvalidArgumentException
* @param array $parameters
*/
public
function
__construct
(
array
$queries
=
[],
array
$parameters
=
[])
public
function
__construct
(
array
$parameters
=
[])
{
foreach
(
$queries
as
$query
)
{
if
(
$query
instanceof
BuilderInterface
)
{
$this
->
queries
[]
=
$query
;
}
else
{
throw
new
\InvalidArgumentException
(
'Arguments must be instance of BuilderInterface'
);
}
}
$this
->
setParameters
(
$parameters
);
}
/**
* Add query.
*
* @param BuilderInterface $query
*
* @return DisMaxQuery
*/
public
function
addQuery
(
BuilderInterface
$query
)
{
$this
->
queries
[]
=
$query
;
return
$this
;
}
/**
* {@inheritdoc}
*/
...
...
This diff is collapsed.
Click to expand it.
Query/FuzzyLikeThisField.php
→
Query/FuzzyLikeThisField
Query
.php
+
1
−
7
View file @
97292a78
...
...
@@ -17,7 +17,7 @@ use ONGR\ElasticsearchBundle\DSL\ParametersTrait;
/**
* Elasticsearch fuzzy_like_this_field query class.
*/
class
FuzzyLikeThisField
implements
BuilderInterface
class
FuzzyLikeThisField
Query
implements
BuilderInterface
{
use
ParametersTrait
;
...
...
@@ -31,11 +31,6 @@ class FuzzyLikeThisField implements BuilderInterface
*/
private
$likeText
;
/**
* @var string
*/
private
$analyzer
;
/**
* @param string $field
* @param string $likeText
...
...
@@ -63,7 +58,6 @@ class FuzzyLikeThisField implements BuilderInterface
{
$query
=
[
'like_text'
=>
$this
->
likeText
,
'analyzer'
=>
$this
->
analyzer
,
];
$output
=
[
...
...
This diff is collapsed.
Click to expand it.
Query/MultiMatchQuery.php
+
11
−
2
View file @
97292a78
...
...
@@ -12,12 +12,15 @@
namespace
ONGR\ElasticsearchBundle\DSL\Query
;
use
ONGR\ElasticsearchBundle\DSL\BuilderInterface
;
use
ONGR\ElasticsearchBundle\DSL\ParametersTrait
;
/**
* Elasticsearch multi_match query class.
*/
class
MultiMatchQuery
implements
BuilderInterface
{
use
ParametersTrait
;
/**
* @var array
*/
...
...
@@ -31,11 +34,13 @@ class MultiMatchQuery implements BuilderInterface
/**
* @param array $fields
* @param string $query
* @param array $parameters
*/
public
function
__construct
(
array
$fields
,
$query
)
public
function
__construct
(
array
$fields
,
$query
,
array
$parameters
=
[]
)
{
$this
->
fields
=
$fields
;
$this
->
query
=
$query
;
$this
->
setParameters
(
$parameters
);
}
/**
...
...
@@ -51,9 +56,13 @@ class MultiMatchQuery implements BuilderInterface
*/
public
function
toArray
()
{
return
[
$query
=
[
'fields'
=>
$this
->
fields
,
'query'
=>
$this
->
query
,
];
$output
=
$this
->
processArray
(
$query
);
return
$output
;
}
}
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