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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
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
* @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).
*/
public
$filter
Part
;
public
$filter
;
public
$facets
=
[];
public
function
init
()
{
parent
::
init
();
...
...
@@ -271,7 +272,6 @@ class Query extends Component implements QueryInterface
foreach
(
$result
[
'hits'
][
'hits'
]
as
$row
)
{
$column
[]
=
isset
(
$row
[
'fields'
][
$field
])
?
$row
[
'fields'
][
$field
]
:
null
;
}
return
$column
;
}
...
...
@@ -316,7 +316,6 @@ class Query extends Component implements QueryInterface
public
function
addFacet
(
$name
,
$type
,
$options
)
{
$this
->
facets
[
$name
]
=
[
$type
=>
$options
];
return
$this
;
}
...
...
@@ -450,7 +449,6 @@ class Query extends Component implements QueryInterface
public
function
query
(
$query
)
{
$this
->
query
=
$query
;
return
$this
;
}
...
...
@@ -459,10 +457,9 @@ class Query extends Component implements QueryInterface
* @param string $filter
* @return static the query object itself
*/
public
function
filter
Part
(
$filter
)
public
function
filter
(
$filter
)
{
$this
->
filterPart
=
$filter
;
$this
->
filter
=
$filter
;
return
$this
;
}
...
...
@@ -479,7 +476,6 @@ class Query extends Component implements QueryInterface
{
$this
->
index
=
$index
;
$this
->
type
=
$type
;
return
$this
;
}
...
...
@@ -496,7 +492,6 @@ class Query extends Component implements QueryInterface
}
else
{
$this
->
fields
=
func_get_args
();
}
return
$this
;
}
...
...
@@ -510,7 +505,6 @@ class Query extends Component implements QueryInterface
public
function
timeout
(
$timeout
)
{
$this
->
timeout
=
$timeout
;
return
$this
;
}
}
extensions/elasticsearch/QueryBuilder.php
View file @
e5ba8c87
...
...
@@ -62,17 +62,17 @@ class QueryBuilder extends \yii\base\Object
}
$whereFilter
=
$this
->
buildCondition
(
$query
->
where
);
if
(
is_string
(
$query
->
filter
Part
))
{
if
(
is_string
(
$query
->
filter
))
{
if
(
empty
(
$whereFilter
))
{
$parts
[
'filter'
]
=
$query
->
filter
Part
;
$parts
[
'filter'
]
=
$query
->
filter
;
}
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
))
{
$parts
[
'filter'
]
=
$query
->
filter
Part
;
$parts
[
'filter'
]
=
$query
->
filter
;
}
else
{
$parts
[
'filter'
]
=
[
'and'
=>
[
$query
->
filter
Part
,
$whereFilter
]];
$parts
[
'filter'
]
=
[
'and'
=>
[
$query
->
filter
,
$whereFilter
]];
}
}
elseif
(
!
empty
(
$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