Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
e5ba8c87
Commit
e5ba8c87
authored
Apr 02, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reverted elasticsearch rename of filter
parent
36c59dce
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
16 deletions
+10
-16
Query.php
extensions/elasticsearch/Query.php
+4
-10
QueryBuilder.php
extensions/elasticsearch/QueryBuilder.php
+6
-6
No files found.
extensions/elasticsearch/Query.php
View file @
e5ba8c87
...
@@ -92,10 +92,11 @@ class Query extends Component implements QueryInterface
...
@@ -92,10 +92,11 @@ class Query extends Component implements QueryInterface
* @var array|string The filter part of this search query. This is an array or json string that follows the format of
* @var array|string The filter part of this search query. This is an array or json string that follows the format of
* the elasticsearch [Query DSL](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl.html).
* the elasticsearch [Query DSL](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl.html).
*/
*/
public
$filter
Part
;
public
$filter
;
public
$facets
=
[];
public
$facets
=
[];
public
function
init
()
public
function
init
()
{
{
parent
::
init
();
parent
::
init
();
...
@@ -271,7 +272,6 @@ class Query extends Component implements QueryInterface
...
@@ -271,7 +272,6 @@ class Query extends Component implements QueryInterface
foreach
(
$result
[
'hits'
][
'hits'
]
as
$row
)
{
foreach
(
$result
[
'hits'
][
'hits'
]
as
$row
)
{
$column
[]
=
isset
(
$row
[
'fields'
][
$field
])
?
$row
[
'fields'
][
$field
]
:
null
;
$column
[]
=
isset
(
$row
[
'fields'
][
$field
])
?
$row
[
'fields'
][
$field
]
:
null
;
}
}
return
$column
;
return
$column
;
}
}
...
@@ -316,7 +316,6 @@ class Query extends Component implements QueryInterface
...
@@ -316,7 +316,6 @@ class Query extends Component implements QueryInterface
public
function
addFacet
(
$name
,
$type
,
$options
)
public
function
addFacet
(
$name
,
$type
,
$options
)
{
{
$this
->
facets
[
$name
]
=
[
$type
=>
$options
];
$this
->
facets
[
$name
]
=
[
$type
=>
$options
];
return
$this
;
return
$this
;
}
}
...
@@ -450,7 +449,6 @@ class Query extends Component implements QueryInterface
...
@@ -450,7 +449,6 @@ class Query extends Component implements QueryInterface
public
function
query
(
$query
)
public
function
query
(
$query
)
{
{
$this
->
query
=
$query
;
$this
->
query
=
$query
;
return
$this
;
return
$this
;
}
}
...
@@ -459,10 +457,9 @@ class Query extends Component implements QueryInterface
...
@@ -459,10 +457,9 @@ class Query extends Component implements QueryInterface
* @param string $filter
* @param string $filter
* @return static the query object itself
* @return static the query object itself
*/
*/
public
function
filter
Part
(
$filter
)
public
function
filter
(
$filter
)
{
{
$this
->
filterPart
=
$filter
;
$this
->
filter
=
$filter
;
return
$this
;
return
$this
;
}
}
...
@@ -479,7 +476,6 @@ class Query extends Component implements QueryInterface
...
@@ -479,7 +476,6 @@ class Query extends Component implements QueryInterface
{
{
$this
->
index
=
$index
;
$this
->
index
=
$index
;
$this
->
type
=
$type
;
$this
->
type
=
$type
;
return
$this
;
return
$this
;
}
}
...
@@ -496,7 +492,6 @@ class Query extends Component implements QueryInterface
...
@@ -496,7 +492,6 @@ class Query extends Component implements QueryInterface
}
else
{
}
else
{
$this
->
fields
=
func_get_args
();
$this
->
fields
=
func_get_args
();
}
}
return
$this
;
return
$this
;
}
}
...
@@ -510,7 +505,6 @@ class Query extends Component implements QueryInterface
...
@@ -510,7 +505,6 @@ class Query extends Component implements QueryInterface
public
function
timeout
(
$timeout
)
public
function
timeout
(
$timeout
)
{
{
$this
->
timeout
=
$timeout
;
$this
->
timeout
=
$timeout
;
return
$this
;
return
$this
;
}
}
}
}
extensions/elasticsearch/QueryBuilder.php
View file @
e5ba8c87
...
@@ -62,17 +62,17 @@ class QueryBuilder extends \yii\base\Object
...
@@ -62,17 +62,17 @@ class QueryBuilder extends \yii\base\Object
}
}
$whereFilter
=
$this
->
buildCondition
(
$query
->
where
);
$whereFilter
=
$this
->
buildCondition
(
$query
->
where
);
if
(
is_string
(
$query
->
filter
Part
))
{
if
(
is_string
(
$query
->
filter
))
{
if
(
empty
(
$whereFilter
))
{
if
(
empty
(
$whereFilter
))
{
$parts
[
'filter'
]
=
$query
->
filter
Part
;
$parts
[
'filter'
]
=
$query
->
filter
;
}
else
{
}
else
{
$parts
[
'filter'
]
=
'{"and": ['
.
$query
->
filter
Part
.
', '
.
Json
::
encode
(
$whereFilter
)
.
']}'
;
$parts
[
'filter'
]
=
'{"and": ['
.
$query
->
filter
.
', '
.
Json
::
encode
(
$whereFilter
)
.
']}'
;
}
}
}
elseif
(
$query
->
filter
Part
!==
null
)
{
}
elseif
(
$query
->
filter
!==
null
)
{
if
(
empty
(
$whereFilter
))
{
if
(
empty
(
$whereFilter
))
{
$parts
[
'filter'
]
=
$query
->
filter
Part
;
$parts
[
'filter'
]
=
$query
->
filter
;
}
else
{
}
else
{
$parts
[
'filter'
]
=
[
'and'
=>
[
$query
->
filter
Part
,
$whereFilter
]];
$parts
[
'filter'
]
=
[
'and'
=>
[
$query
->
filter
,
$whereFilter
]];
}
}
}
elseif
(
!
empty
(
$whereFilter
))
{
}
elseif
(
!
empty
(
$whereFilter
))
{
$parts
[
'filter'
]
=
$whereFilter
;
$parts
[
'filter'
]
=
$whereFilter
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment