Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
solarium
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
solarium
Commits
0939d724
Commit
0939d724
authored
Oct 02, 2013
by
delf.tonder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes #214, returning nested debug-information
parent
05cab9bd
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
6 deletions
+61
-6
library/Solarium/QueryType/Select/ResponseParser/Component/Debug.php
...arium/QueryType/Select/ResponseParser/Component/Debug.php
+6
-1
library/Solarium/QueryType/Select/Result/Debug/Detail.php
library/Solarium/QueryType/Select/Result/Debug/Detail.php
+20
-0
tests/Solarium/Tests/QueryType/Select/ResponseParser/Component/DebugTest.php
...s/QueryType/Select/ResponseParser/Component/DebugTest.php
+29
-5
tests/Solarium/Tests/QueryType/Select/Result/Debug/DetailTest.php
...larium/Tests/QueryType/Select/Result/Debug/DetailTest.php
+6
-0
No files found.
library/Solarium/QueryType/Select/ResponseParser/Component/Debug.php
View file @
0939d724
...
...
@@ -135,11 +135,16 @@ class Debug implements ComponentParserInterface
$details
=
array
();
if
(
isset
(
$documentData
[
'details'
])
&&
is_array
(
$documentData
[
'details'
]))
{
foreach
(
$documentData
[
'details'
]
as
$detailData
)
{
$detail
s
[]
=
new
Detail
(
$detail
=
new
Detail
(
$detailData
[
'match'
],
$detailData
[
'value'
],
$detailData
[
'description'
]
);
if
(
isset
(
$detailData
[
'details'
])
&&
is_array
(
$detailData
[
'details'
]))
{
$detail
->
setSubDetails
(
$detailData
[
'details'
]);
}
$details
[]
=
$detail
;
}
}
...
...
library/Solarium/QueryType/Select/Result/Debug/Detail.php
View file @
0939d724
...
...
@@ -65,6 +65,11 @@ class Detail
*/
protected
$description
;
/**
* @var array
*/
protected
$subDetails
;
/**
* Constructor
*
...
...
@@ -109,4 +114,19 @@ class Detail
return
$this
->
description
;
}
/**
* @param array $subDetails
*/
public
function
setSubDetails
(
$subDetails
)
{
$this
->
subDetails
=
$subDetails
;
}
/**
* @return array
*/
public
function
getSubDetails
()
{
return
$this
->
subDetails
;
}
}
tests/Solarium/Tests/QueryType/Select/ResponseParser/Component/DebugTest.php
View file @
0939d724
...
...
@@ -63,8 +63,20 @@ class DebugTest extends \PHPUnit_Framework_TestCase
array
(
'match'
=>
true
,
'value'
=>
0.5
,
'description'
=>
'sum of:'
,
'details'
=>
array
(
array
(
'match'
=>
true
,
'value'
=>
0.25
,
'description'
=>
'weight(dummyfield:flachdach^250.0 in 1311) [], result of:'
),
array
(
'match'
=>
true
,
'value'
=>
0.25
,
'description'
=>
'tf(termFreq(text:ipod)=1)'
,
)
)
)
),
),
),
...
...
@@ -117,11 +129,23 @@ class DebugTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
0.5
,
$doc
->
getValue
());
$this
->
assertEquals
(
true
,
$doc
->
getMatch
());
$this
->
assertEquals
(
'fieldWeight(text:ipod in 5), product of:'
,
$doc
->
getDescription
());
$this
->
assertEquals
(
array
(
new
Detail
(
true
,
0.5
,
'tf(termFreq(text:ipod)=1)'
)),
$doc
->
getDetails
()
);
$expectedDetail
=
new
Detail
(
true
,
0.5
,
'sum of:'
);
$expectedDetail
->
setSubDetails
(
array
(
array
(
'match'
=>
true
,
'value'
=>
0.25
,
'description'
=>
'weight(dummyfield:flachdach^250.0 in 1311) [], result of:'
),
array
(
'match'
=>
true
,
'value'
=>
0.25
,
'description'
=>
'tf(termFreq(text:ipod)=1)'
,
)
)
);
$this
->
assertEquals
(
array
(
$expectedDetail
),
$doc
->
getDetails
());
$this
->
assertEquals
(
1
,
count
(
$result
->
getExplainOther
()));
$doc
=
$result
->
getExplainOther
()
->
getDocument
(
'IW-02'
);
$this
->
assertEquals
(
0.6
,
$doc
->
getValue
());
...
...
tests/Solarium/Tests/QueryType/Select/Result/Debug/DetailTest.php
View file @
0939d724
...
...
@@ -70,4 +70,10 @@ class DetailTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
$this
->
description
,
$this
->
result
->
getDescription
());
}
public
function
testSetSubDetails
()
{
$subDetailsDummy
=
array
(
'dummy'
,
'testing'
);
$this
->
result
->
setSubDetails
(
$subDetailsDummy
);
$this
->
assertEquals
(
$subDetailsDummy
,
$this
->
result
->
getSubDetails
());
}
}
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