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
eb5d6022
Commit
eb5d6022
authored
Nov 27, 2011
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/debugcomponent' into develop
parents
e00a5d70
c7565876
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
1917 additions
and
3 deletions
+1917
-3
examples/2.1.5.11-debug.php
examples/2.1.5.11-debug.php
+69
-0
examples/index.html
examples/index.html
+1
-0
library/Solarium/Client/RequestBuilder/Select/Component/Debug.php
...Solarium/Client/RequestBuilder/Select/Component/Debug.php
+63
-0
library/Solarium/Client/ResponseParser/Select/Component/Debug.php
...Solarium/Client/ResponseParser/Select/Component/Debug.php
+174
-0
library/Solarium/Query/Select.php
library/Solarium/Query/Select.php
+22
-0
library/Solarium/Query/Select/Component/Debug.php
library/Solarium/Query/Select/Component/Debug.php
+78
-0
library/Solarium/Result.php
library/Solarium/Result.php
+2
-2
library/Solarium/Result/Select.php
library/Solarium/Result/Select.php
+12
-0
library/Solarium/Result/Select/Debug.php
library/Solarium/Result/Select/Debug.php
+197
-0
library/Solarium/Result/Select/Debug/Detail.php
library/Solarium/Result/Select/Debug/Detail.php
+107
-0
library/Solarium/Result/Select/Debug/Document.php
library/Solarium/Result/Select/Debug/Document.php
+113
-0
library/Solarium/Result/Select/Debug/DocumentSet.php
library/Solarium/Result/Select/Debug/DocumentSet.php
+111
-0
library/Solarium/Result/Select/Debug/Timing.php
library/Solarium/Result/Select/Debug/Timing.php
+127
-0
library/Solarium/Result/Select/Debug/TimingPhase.php
library/Solarium/Result/Select/Debug/TimingPhase.php
+135
-0
tests/Solarium/Client/RequestBuilder/Select/Component/DebugTest.php
...rium/Client/RequestBuilder/Select/Component/DebugTest.php
+56
-0
tests/Solarium/Query/Select/Component/DebugTest.php
tests/Solarium/Query/Select/Component/DebugTest.php
+75
-0
tests/Solarium/Query/SelectTest.php
tests/Solarium/Query/SelectTest.php
+10
-0
tests/Solarium/Result/Select/Debug/DetailTest.php
tests/Solarium/Result/Select/Debug/DetailTest.php
+70
-0
tests/Solarium/Result/Select/Debug/DocumentSetTest.php
tests/Solarium/Result/Select/Debug/DocumentSetTest.php
+88
-0
tests/Solarium/Result/Select/Debug/DocumentTest.php
tests/Solarium/Result/Select/Debug/DocumentTest.php
+85
-0
tests/Solarium/Result/Select/Debug/TimingPhaseTest.php
tests/Solarium/Result/Select/Debug/TimingPhaseTest.php
+98
-0
tests/Solarium/Result/Select/Debug/TimingTest.php
tests/Solarium/Result/Select/Debug/TimingTest.php
+97
-0
tests/Solarium/Result/Select/DebugTest.php
tests/Solarium/Result/Select/DebugTest.php
+115
-0
tests/Solarium/Result/SelectTest.php
tests/Solarium/Result/SelectTest.php
+12
-1
No files found.
examples/2.1.5.11-debug.php
0 → 100644
View file @
eb5d6022
<?php
require
(
'init.php'
);
htmlHeader
();
// create a client instance
$client
=
new
Solarium_Client
(
$config
);
// get a select query instance
$query
=
$client
->
createSelect
();
$query
->
setQuery
(
'ipod'
);
// add debug settings
$debug
=
$query
->
getDebug
();
$debug
->
setExplainOther
(
'id:MA*'
);
// this executes the query and returns the result
$resultset
=
$client
->
select
(
$query
);
$debugResult
=
$resultset
->
getDebug
();
// display the debug results
echo
'<h1>Debug data</h1>'
;
echo
'Querystring: '
.
$debugResult
->
getQueryString
()
.
'<br/>'
;
echo
'Parsed query: '
.
$debugResult
->
getParsedQuery
()
.
'<br/>'
;
echo
'Query parser: '
.
$debugResult
->
getQueryParser
()
.
'<br/>'
;
echo
'Other query: '
.
$debugResult
->
getOtherQuery
()
.
'<br/>'
;
echo
'<h2>Explain data</h2>'
;
foreach
(
$debugResult
->
getExplain
()
as
$key
=>
$explanation
)
{
echo
'<h3>Document key: '
.
$key
.
'</h3>'
;
echo
'Value: '
.
$explanation
->
getValue
()
.
'<br/>'
;
echo
'Match: '
.
((
$explanation
->
getMatch
()
==
true
)
?
'true'
:
'false'
)
.
'<br/>'
;
echo
'Description: '
.
$explanation
->
getDescription
()
.
'<br/>'
;
echo
'<h4>Details</h4>'
;
foreach
(
$explanation
AS
$detail
)
{
echo
'Value: '
.
$detail
->
getValue
()
.
'<br/>'
;
echo
'Match: '
.
((
$detail
->
getMatch
()
==
true
)
?
'true'
:
'false'
)
.
'<br/>'
;
echo
'Description: '
.
$detail
->
getDescription
()
.
'<br/>'
;
echo
'<hr/>'
;
}
}
echo
'<h2>ExplainOther data</h2>'
;
foreach
(
$debugResult
->
getExplainOther
()
as
$key
=>
$explanation
)
{
echo
'<h3>Document key: '
.
$key
.
'</h3>'
;
echo
'Value: '
.
$explanation
->
getValue
()
.
'<br/>'
;
echo
'Match: '
.
((
$explanation
->
getMatch
()
==
true
)
?
'true'
:
'false'
)
.
'<br/>'
;
echo
'Description: '
.
$explanation
->
getDescription
()
.
'<br/>'
;
echo
'<h4>Details</h4>'
;
foreach
(
$explanation
AS
$detail
)
{
echo
'Value: '
.
$detail
->
getValue
()
.
'<br/>'
;
echo
'Match: '
.
((
$detail
->
getMatch
()
==
true
)
?
'true'
:
'false'
)
.
'<br/>'
;
echo
'Description: '
.
$detail
->
getDescription
()
.
'<br/>'
;
echo
'<hr/>'
;
}
}
echo
'<h2>Timings (in ms)</h2>'
;
echo
'Total time: '
.
$debugResult
->
getTiming
()
->
getTime
()
.
'<br/>'
;
echo
'<h3>Phases</h3>'
;
foreach
(
$debugResult
->
getTiming
()
->
getPhases
()
as
$phaseName
=>
$phaseData
)
{
echo
'<h4>'
.
$phaseName
.
'</h4>'
;
foreach
(
$phaseData
as
$class
=>
$time
)
{
echo
$class
.
': '
.
$time
.
'<br/>'
;
}
echo
'<hr/>'
;
}
htmlFooter
();
\ No newline at end of file
examples/index.html
View file @
eb5d6022
...
...
@@ -55,6 +55,7 @@
<li><a
href=
"2.1.5.8-distributed-search.php"
>
2.1.5.8 Distributed search (sharding)
</a></li>
<li><a
href=
"2.1.5.9-spellcheck.php"
>
2.1.5.9 Spellcheck
</a></li>
<li><a
href=
"2.1.5.10-stats.php"
>
2.1.5.10 Stats
</a></li>
<li><a
href=
"2.1.5.11-debug.php"
>
2.1.5.11 Debug (DebugQuery)
</a></li>
</ul>
<li><a
href=
"2.1.6-helper-functions.php"
>
2.1.6 Helper functions
</a></li>
<li><a
href=
"2.1.7-query-reuse.php"
>
2.1.7 Query re-use
</a></li>
...
...
library/Solarium/Client/RequestBuilder/Select/Component/Debug.php
0 → 100644
View file @
eb5d6022
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*
* @package Solarium
* @subpackage Client
*/
/**
* Add select component debug to the request
*
* @package Solarium
* @subpackage Client
*/
class
Solarium_Client_RequestBuilder_Select_Component_Debug
{
/**
* Add request settings for the debug component
*
* @param Solarium_Query_Select_Component_Debug $component
* @param Solarium_Client_Request $request
* @return Solarium_Client_Request
*/
public
function
build
(
$component
,
$request
)
{
$request
->
addParam
(
'debugQuery'
,
'true'
);
$request
->
addParam
(
'debug.explain.structured'
,
'true'
);
$request
->
addParam
(
'explainOther'
,
$component
->
getExplainOther
());
return
$request
;
}
}
\ No newline at end of file
library/Solarium/Client/ResponseParser/Select/Component/Debug.php
0 → 100644
View file @
eb5d6022
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*
* @package Solarium
* @subpackage Client
*/
/**
* Parse select component Debug result from the data
*
* @package Solarium
* @subpackage Client
*/
class
Solarium_Client_ResponseParser_Select_Component_Debug
{
/**
* Parse result data into result objects
*
* @param Solarium_Query_Select $query
* @param Solarium_Query_Select_Component_Debug $component
* @param array $data
* @return Solarium_Result_Select_Debug|null
*/
public
function
parse
(
$query
,
$component
,
$data
)
{
$result
=
null
;
if
(
isset
(
$data
[
'debug'
]))
{
$debug
=
$data
[
'debug'
];
// get basic values from data
$queryString
=
(
isset
(
$debug
[
'querystring'
]))
?
$debug
[
'querystring'
]
:
''
;
$parsedQuery
=
(
isset
(
$debug
[
'parsedquery'
]))
?
$debug
[
'parsedquery'
]
:
''
;
$queryParser
=
(
isset
(
$debug
[
'QParser'
]))
?
$debug
[
'QParser'
]
:
''
;
$otherQuery
=
(
isset
(
$debug
[
'otherQuery'
]))
?
$debug
[
'otherQuery'
]
:
''
;
// parse explain data
if
(
isset
(
$debug
[
'explain'
])
&&
is_array
(
$debug
[
'explain'
]))
{
$explain
=
$this
->
_parseDocumentSet
(
$debug
[
'explain'
]);
}
else
{
$explain
=
new
Solarium_Result_Select_Debug_DocumentSet
(
array
());
}
// parse explainOther data
if
(
isset
(
$debug
[
'explainOther'
])
&&
is_array
(
$debug
[
'explainOther'
]))
{
$explainOther
=
$this
->
_parseDocumentSet
(
$debug
[
'explainOther'
]);
}
else
{
$explainOther
=
new
Solarium_Result_Select_Debug_DocumentSet
(
array
());
}
// parse timing data
$timing
=
null
;
if
(
isset
(
$debug
[
'timing'
])
&&
is_array
(
$debug
[
'timing'
]))
{
$time
=
null
;
$timingPhases
=
array
();
foreach
(
$debug
[
'timing'
]
as
$key
=>
$timingData
)
{
switch
(
$key
)
{
case
'time'
:
$time
=
$timingData
;
break
;
default
:
$timingPhases
[
$key
]
=
$this
->
_parseTimingPhase
(
$key
,
$timingData
);
}
}
$timing
=
new
Solarium_Result_Select_Debug_Timing
(
$time
,
$timingPhases
);
}
// create result object
$result
=
new
Solarium_Result_Select_Debug
(
$queryString
,
$parsedQuery
,
$queryParser
,
$otherQuery
,
$explain
,
$explainOther
,
$timing
);
}
return
$result
;
}
/**
* Parse data into a documentset
*
* Used for explain and explainOther
*
* @param array $data
* @return array
*/
protected
function
_parseDocumentSet
(
$data
)
{
$docs
=
array
();
foreach
(
$data
as
$key
=>
$documentData
)
{
$details
=
array
();
if
(
isset
(
$documentData
[
'details'
])
&&
is_array
(
$documentData
[
'details'
]))
{
foreach
(
$documentData
[
'details'
]
as
$detailData
)
{
$details
[]
=
new
Solarium_Result_Select_Debug_Detail
(
$detailData
[
'match'
],
$detailData
[
'value'
],
$detailData
[
'description'
]
);
}
}
$docs
[
$key
]
=
new
Solarium_Result_Select_Debug_Document
(
$key
,
$documentData
[
'match'
],
$documentData
[
'value'
],
$documentData
[
'description'
],
$details
);
}
return
$docs
;
}
/**
* Parse raw timing phase data into a result class
*
* @param string $name
* @param array $data
* @return Solarium_Result_Select_Debug_TimingPhase
*/
protected
function
_parseTimingPhase
(
$name
,
$data
)
{
$time
=
0.0
;
$classes
=
array
();
foreach
(
$data
as
$key
=>
$timingData
)
{
switch
(
$key
)
{
case
'time'
:
$time
=
$timingData
;
break
;
default
:
$classes
[
$key
]
=
$timingData
[
'time'
];
}
}
return
new
Solarium_Result_Select_Debug_TimingPhase
(
$name
,
$time
,
$classes
);
}
}
\ No newline at end of file
library/Solarium/Query/Select.php
View file @
eb5d6022
...
...
@@ -109,6 +109,11 @@ class Solarium_Query_Select extends Solarium_Query
*/
const
COMPONENT_STATS
=
'stats'
;
/**
* Query component debug
*/
const
COMPONENT_DEBUG
=
'debug'
;
/**
* Get type for this query
*
...
...
@@ -180,6 +185,11 @@ class Solarium_Query_Select extends Solarium_Query
'requestbuilder'
=>
'Solarium_Client_RequestBuilder_Select_Component_Stats'
,
'responseparser'
=>
'Solarium_Client_ResponseParser_Select_Component_Stats'
,
),
self
::
COMPONENT_DEBUG
=>
array
(
'component'
=>
'Solarium_Query_Select_Component_Debug'
,
'requestbuilder'
=>
'Solarium_Client_RequestBuilder_Select_Component_Debug'
,
'responseparser'
=>
'Solarium_Client_ResponseParser_Select_Component_Debug'
,
),
);
/**
...
...
@@ -950,4 +960,16 @@ class Solarium_Query_Select extends Solarium_Query
return
$this
->
getComponent
(
Solarium_Query_Select
::
COMPONENT_STATS
,
true
);
}
/**
* Get a Debug component instance
*
* This is a convenience method that maps presets to getComponent
*
* @return Solarium_Query_Select_Component_Debug
*/
public
function
getDebug
()
{
return
$this
->
getComponent
(
Solarium_Query_Select
::
COMPONENT_DEBUG
,
true
);
}
}
library/Solarium/Query/Select/Component/Debug.php
0 → 100644
View file @
eb5d6022
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*
* @package Solarium
* @subpackage Query
*/
/**
* Debug component
*
* @link http://wiki.apache.org/solr/CommonQueryParameters#Debugging
*
* @package Solarium
* @subpackage Query
*/
class
Solarium_Query_Select_Component_Debug
extends
Solarium_Query_Select_Component
{
/**
* Component type
*
* @var string
*/
protected
$_type
=
Solarium_Query_Select
::
COMPONENT_DEBUG
;
/**
* Get the explainOther option
*
* @return string|null
*/
public
function
getExplainOther
()
{
return
$this
->
getOption
(
'explainother'
);
}
/**
* Set the explainOther query
*
* @param string $query
* @return self Provides fluent interface
*/
public
function
setExplainOther
(
$query
)
{
return
$this
->
_setOption
(
'explainother'
,
$query
);
}
}
\ No newline at end of file
library/Solarium/Result.php
View file @
eb5d6022
...
...
@@ -125,7 +125,7 @@ class Solarium_Result
/**
* Get Solr response data
*
* Include
d
a lazy loading mechanism: JSON body data is decoded on first use and then saved for reuse.
* Include
s
a lazy loading mechanism: JSON body data is decoded on first use and then saved for reuse.
*
* @return array
*/
...
...
library/Solarium/Result/Select.php
View file @
eb5d6022
...
...
@@ -281,4 +281,16 @@ class Solarium_Result_Select extends Solarium_Result_QueryType
{
return
$this
->
getComponent
(
Solarium_Query_Select
::
COMPONENT_STATS
);
}
/**
* Get debug component result
*
* This is a convenience method that maps presets to getComponent
*
* @return Solarium_Result_Select_Debug
*/
public
function
getDebug
()
{
return
$this
->
getComponent
(
Solarium_Query_Select
::
COMPONENT_DEBUG
);
}
}
\ No newline at end of file
library/Solarium/Result/Select/Debug.php
0 → 100644
View file @
eb5d6022
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*
* @package Solarium
* @subpackage Result
*/
/**
* Select component debug result
*
* @package Solarium
* @subpackage Result
*/
class
Solarium_Result_Select_Debug
implements
IteratorAggregate
,
Countable
{
/**
* @var string
*/
protected
$_queryString
;
/**
* @var string
*/
protected
$_parsedQuery
;
/**
* @var string
*/
protected
$_queryParser
;
/**
* @var string
*/
protected
$_otherQuery
;
/**
* @var Solarium_Result_Select_Debug_DocumentSet
*/
protected
$_explain
;
/**
* @var Solarium_Result_Select_Debug_DocumentSet
*/
protected
$_explainOther
;
/**
* @var Solarium_Result_Select_Debug_Timing
*/
protected
$_timing
;
/**
* Constructor
*
* @param string $queryString
* @param string $parsedQuery
* @param string $queryParser
* @param string $otherQuery
* @param Solarium_Result_Select_Debug_DocumentSet $explain
* @param Solarium_Result_Select_Debug_DocumentSet $explainOther
* @param Solarium_Result_Select_Debug_Timing $timing
*/
public
function
__construct
(
$queryString
,
$parsedQuery
,
$queryParser
,
$otherQuery
,
$explain
,
$explainOther
,
$timing
)
{
$this
->
_queryString
=
$queryString
;
$this
->
_parsedQuery
=
$parsedQuery
;
$this
->
_queryParser
=
$queryParser
;
$this
->
_otherQuery
=
$otherQuery
;
$this
->
_explain
=
$explain
;
$this
->
_explainOther
=
$explainOther
;
$this
->
_timing
=
$timing
;
}
/**
* Get input querystring
*
* @return string
*/
public
function
getQueryString
()
{
return
$this
->
_queryString
;
}
/**
* Get the result of the queryparser
*
* @return string
*/
public
function
getParsedQuery
()
{
return
$this
->
_parsedQuery
;
}
/**
* Get the used queryparser
*
* @return string
*/
public
function
getQueryParser
()
{
return
$this
->
_queryParser
;
}
/**
* Get other query (only available if set in query)
*
* @return string
*/
public
function
getOtherQuery
()
{
return
$this
->
_otherQuery
;
}
/**
* Get explain document set
*
* @return Solarium_Result_Select_Debug_DocumentSet
*/
public
function
getExplain
()
{
return
$this
->
_explain
;
}
/**
* Get explain other document set (only available if otherquery was set in query)
*
* @return Solarium_Result_Select_Debug_DocumentSet
*/
public
function
getExplainOther
()
{
return
$this
->
_explainOther
;
}
/**
* Get timing object
*
* @return Solarium_Result_Select_Debug_Timing
*/
public
function
getTiming
()
{
return
$this
->
_timing
;
}
/**
* IteratorAggregate implementation
*
* Iterates the explain results
*
* @return Solarium_Result_Select_Debug_DocumentSet
*/
public
function
getIterator
()
{
return
$this
->
_explain
;
}
/**
* Countable implementation
*
* @return int
*/
public
function
count
()
{
return
count
(
$this
->
_explain
);
}
}
\ No newline at end of file
library/Solarium/Result/Select/Debug/Detail.php
0 → 100644
View file @
eb5d6022
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*
* @package Solarium
* @subpackage Result
*/
/**
* Select component debug detail result
*
* @package Solarium
* @subpackage Result
*/
class
Solarium_Result_Select_Debug_Detail
{
/**
* @var float
*/
protected
$_value
;
/**
* @var boolean
*/
protected
$_match
;
/**
* @var string
*/
protected
$_description
;
/**
* Constructor
*
* @param boolean $match
* @param float $value
* @param string $description
*/
public
function
__construct
(
$match
,
$value
,
$description
)
{
$this
->
_match
=
$match
;
$this
->
_value
=
$value
;
$this
->
_description
=
$description
;
}
/**
* Get match status
*
* @return bool
*/
public
function
getMatch
()
{
return
$this
->
_match
;
}
/**
* Get match value (score)
*
* @return float
*/
public
function
getValue
()
{
return
$this
->
_value
;
}
/**
* Get description
*
* @return string
*/
public
function
getDescription
()
{
return
$this
->
_description
;
}
}
library/Solarium/Result/Select/Debug/Document.php
0 → 100644
View file @
eb5d6022
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*
* @package Solarium
* @subpackage Result
*/
/**
* Select component debug document result
*
* @package Solarium
* @subpackage Result
*/
class
Solarium_Result_Select_Debug_Document
extends
Solarium_Result_Select_Debug_Detail
implements
IteratorAggregate
,
Countable
{
/**
* @var string
*/
protected
$_key
;
/**
* @var array
*/
protected
$_details
;
/**
* Constructor
*
* @param string $key
* @param boolean $match
* @param float $value
* @param string $description
*/
public
function
__construct
(
$key
,
$match
,
$value
,
$description
,
$details
)
{
parent
::
__construct
(
$match
,
$value
,
$description
);
$this
->
_key
=
$key
;
$this
->
_details
=
$details
;
}
/**
* Get key value for this document
*
* @return string
*/
public
function
getKey
()
{
return
$this
->
_key
;
}
/**
* Get details
*
* @return array
*/
public
function
getDetails
()
{
return
$this
->
_details
;
}
/**
* IteratorAggregate implementation
*
* @return ArrayIterator
*/
public
function
getIterator
()
{
return
new
ArrayIterator
(
$this
->
_details
);
}
/**
* Countable implementation
*
* @return int
*/
public
function
count
()
{
return
count
(
$this
->
_details
);
}
}
library/Solarium/Result/Select/Debug/DocumentSet.php
0 → 100644
View file @
eb5d6022
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*
* @package Solarium
* @subpackage Result
*/
/**
* Select component debug documentset result
*
* @package Solarium
* @subpackage Result
*/
class
Solarium_Result_Select_Debug_DocumentSet
implements
IteratorAggregate
,
Countable
{
/**
* Docs array
*
* @var array
*/
protected
$_docs
;
/**
* Constructor
*
* @param array $docs
* @return void
*/
public
function
__construct
(
$docs
)
{
$this
->
_docs
=
$docs
;
}
/**
* Get a document by key
*
* @param mixed $key
* @return Solarium_Result_Select_Debug_Document|null
*/
public
function
getDocument
(
$key
)
{
if
(
isset
(
$this
->
_docs
[
$key
]))
{
return
$this
->
_docs
[
$key
];
}
else
{
return
null
;
}
}
/**
* Get all docs
*
* @return array
*/
public
function
getDocuments
()
{
return
$this
->
_docs
;
}
/**
* IteratorAggregate implementation
*
* @return ArrayIterator
*/
public
function
getIterator
()
{
return
new
ArrayIterator
(
$this
->
_docs
);
}
/**
* Countable implementation
*
* @return int
*/
public
function
count
()
{
return
count
(
$this
->
_docs
);
}
}
library/Solarium/Result/Select/Debug/Timing.php
0 → 100644
View file @
eb5d6022
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*
* @package Solarium
* @subpackage Result
*/
/**
* Select component debug timing result
*
* @package Solarium
* @subpackage Result
*/
class
Solarium_Result_Select_Debug_Timing
implements
IteratorAggregate
,
Countable
{
/**
* @var float
*/
protected
$_time
;
/**
* Timing phase array
*
* @var array
*/
protected
$_phases
;
/**
* Constructor
*
* @param float $time
* @param array $phases
* @return void
*/
public
function
__construct
(
$time
,
$phases
)
{
$this
->
_time
=
$time
;
$this
->
_phases
=
$phases
;
}
/**
* Get total time
*
* @return float
*/
public
function
getTime
()
{
return
$this
->
_time
;
}
/**
* Get a timing phase by key
*
* @param mixed $key
* @return Solarium_Result_Select_Debug_TimingPhase|null
*/
public
function
getPhase
(
$key
)
{
if
(
isset
(
$this
->
_phases
[
$key
]))
{
return
$this
->
_phases
[
$key
];
}
else
{
return
null
;
}
}
/**
* Get timings
*
* @return array
*/
public
function
getPhases
()
{
return
$this
->
_phases
;
}
/**
* IteratorAggregate implementation
*
* @return ArrayIterator
*/
public
function
getIterator
()
{
return
new
ArrayIterator
(
$this
->
_phases
);
}
/**
* Countable implementation
*
* @return int
*/
public
function
count
()
{
return
count
(
$this
->
_phases
);
}
}
library/Solarium/Result/Select/Debug/TimingPhase.php
0 → 100644
View file @
eb5d6022
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*
* @package Solarium
* @subpackage Result
*/
/**
* Select component debug timing phase result
*
* @package Solarium
* @subpackage Result
*/
class
Solarium_Result_Select_Debug_TimingPhase
implements
IteratorAggregate
,
Countable
{
/**
* @var string
*/
protected
$_name
;
/**
* @var float
*/
protected
$_time
;
/**
* Timing array
*
* @var array
*/
protected
$_timings
;
/**
* Constructor
*
* @param string $name
* @param float $time
* @param array $timings
* @return void
*/
public
function
__construct
(
$name
,
$time
,
$timings
)
{
$this
->
_name
=
$name
;
$this
->
_time
=
$time
;
$this
->
_timings
=
$timings
;
}
/**
* Get total time
*
* @return float
*/
public
function
getTime
()
{
return
$this
->
_time
;
}
/**
* Get a timing by key
*
* @param mixed $key
* @return float|null
*/
public
function
getTiming
(
$key
)
{
if
(
isset
(
$this
->
_timings
[
$key
]))
{
return
$this
->
_timings
[
$key
];
}
else
{
return
null
;
}
}
/**
* Get timings
*
* @return array
*/
public
function
getTimings
()
{
return
$this
->
_timings
;
}
/**
* IteratorAggregate implementation
*
* @return ArrayIterator
*/
public
function
getIterator
()
{
return
new
ArrayIterator
(
$this
->
_timings
);
}
/**
* Countable implementation
*
* @return int
*/
public
function
count
()
{
return
count
(
$this
->
_timings
);
}
}
tests/Solarium/Client/RequestBuilder/Select/Component/DebugTest.php
0 → 100644
View file @
eb5d6022
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*/
class
Solarium_Client_RequestBuilder_Select_Component_DebugTest
extends
PHPUnit_Framework_TestCase
{
public
function
testBuild
()
{
$builder
=
new
Solarium_Client_RequestBuilder_Select_Component_Debug
();
$request
=
new
Solarium_Client_Request
();
$component
=
new
Solarium_Query_Select_Component_Debug
();
$component
->
setExplainOther
(
'id:45'
);
$request
=
$builder
->
build
(
$component
,
$request
);
$this
->
assertEquals
(
array
(
'debugQuery'
=>
true
,
'debug.explain.structured'
=>
true
,
'explainOther'
=>
'id:45'
,
),
$request
->
getParams
()
);
}
}
\ No newline at end of file
tests/Solarium/Query/Select/Component/DebugTest.php
0 → 100644
View file @
eb5d6022
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*/
class
Solarium_Query_Select_Component_DebugTest
extends
PHPUnit_Framework_TestCase
{
/**
* @var Solarium_Query_Select_Component_Debug
*/
protected
$_debug
;
public
function
setUp
()
{
$this
->
_debug
=
new
Solarium_Query_Select_Component_Debug
;
}
public
function
testConfigMode
()
{
$options
=
array
(
'explainother'
=>
'id:12'
,
);
$this
->
_debug
->
setOptions
(
$options
);
$this
->
assertEquals
(
$options
[
'explainother'
],
$this
->
_debug
->
getExplainOther
());
}
public
function
testGetType
()
{
$this
->
assertEquals
(
Solarium_Query_Select
::
COMPONENT_DEBUG
,
$this
->
_debug
->
getType
()
);
}
public
function
testSetAndGetExplainOther
()
{
$value
=
'id:24'
;
$this
->
_debug
->
setExplainOther
(
$value
);
$this
->
assertEquals
(
$value
,
$this
->
_debug
->
getExplainOther
()
);
}
}
tests/Solarium/Query/SelectTest.php
View file @
eb5d6022
...
...
@@ -630,4 +630,14 @@ class Solarium_Query_SelectTest extends PHPUnit_Framework_TestCase
get_class
(
$stats
)
);
}
public
function
testGetDebug
()
{
$stats
=
$this
->
_query
->
getDebug
();
$this
->
assertEquals
(
'Solarium_Query_Select_Component_Debug'
,
get_class
(
$stats
)
);
}
}
tests/Solarium/Result/Select/Debug/DetailTest.php
0 → 100644
View file @
eb5d6022
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*/
class
Solarium_Result_Select_Debug_DetailTest
extends
PHPUnit_Framework_TestCase
{
/**
* @var Solarium_Result_Select_Debug_Detail
*/
protected
$_result
;
protected
$_value
,
$_match
,
$_description
;
public
function
setUp
()
{
$this
->
_value
=
1.5
;
$this
->
_match
=
true
;
$this
->
_description
=
'dummy-desc'
;
$this
->
_result
=
new
Solarium_Result_Select_Debug_Detail
(
$this
->
_match
,
$this
->
_value
,
$this
->
_description
);
}
public
function
testGetValue
()
{
$this
->
assertEquals
(
$this
->
_value
,
$this
->
_result
->
getValue
());
}
public
function
testGetMatch
()
{
$this
->
assertEquals
(
$this
->
_match
,
$this
->
_result
->
getMatch
());
}
public
function
testGetDescription
()
{
$this
->
assertEquals
(
$this
->
_description
,
$this
->
_result
->
getDescription
());
}
}
tests/Solarium/Result/Select/Debug/DocumentSetTest.php
0 → 100644
View file @
eb5d6022
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*/
class
Solarium_Result_Select_Debug_DocumentSetTest
extends
PHPUnit_Framework_TestCase
{
/**
* @var Solarium_Result_Select_Debug_DocumentSet
*/
protected
$_result
;
protected
$_docs
;
public
function
setUp
()
{
$this
->
_docs
=
array
(
'key1'
=>
'dummy1'
,
'key2'
=>
'dummy2'
);
$this
->
_result
=
new
Solarium_Result_Select_Debug_DocumentSet
(
$this
->
_docs
);
}
public
function
testGetDocument
()
{
$this
->
assertEquals
(
$this
->
_docs
[
'key1'
],
$this
->
_result
->
getDocument
(
'key1'
)
);
}
public
function
testGetDocumentWithInvalidKey
()
{
$this
->
assertEquals
(
null
,
$this
->
_result
->
getDocument
(
'invalidkey'
)
);
}
public
function
testGetDocuments
()
{
$this
->
assertEquals
(
$this
->
_docs
,
$this
->
_result
->
getDocuments
()
);
}
public
function
testIterator
()
{
$items
=
array
();
foreach
(
$this
->
_result
AS
$key
=>
$item
)
{
$items
[
$key
]
=
$item
;
}
$this
->
assertEquals
(
$this
->
_docs
,
$items
);
}
public
function
testCount
()
{
$this
->
assertEquals
(
count
(
$this
->
_docs
),
count
(
$this
->
_result
));
}
}
tests/Solarium/Result/Select/Debug/DocumentTest.php
0 → 100644
View file @
eb5d6022
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*/
class
Solarium_Result_Select_Debug_DocumentTest
extends
PHPUnit_Framework_TestCase
{
/**
* @var Solarium_Result_Select_Debug_Document
*/
protected
$_result
;
protected
$_value
,
$_match
,
$_description
,
$_key
,
$_details
;
public
function
setUp
()
{
$this
->
_key
=
'dummy-key'
;
$this
->
_value
=
1.5
;
$this
->
_match
=
true
;
$this
->
_description
=
'dummy-desc'
;
$this
->
_details
=
array
(
0
=>
'dummy1'
,
1
=>
'dummy2'
);
$this
->
_result
=
new
Solarium_Result_Select_Debug_Document
(
$this
->
_key
,
$this
->
_match
,
$this
->
_value
,
$this
->
_description
,
$this
->
_details
);
}
public
function
testGetKey
()
{
$this
->
assertEquals
(
$this
->
_key
,
$this
->
_result
->
getKey
());
}
public
function
testGetDetails
()
{
$this
->
assertEquals
(
$this
->
_details
,
$this
->
_result
->
getDetails
());
}
public
function
testIterator
()
{
$items
=
array
();
foreach
(
$this
->
_result
AS
$key
=>
$item
)
{
$items
[
$key
]
=
$item
;
}
$this
->
assertEquals
(
$this
->
_details
,
$items
);
}
public
function
testCount
()
{
$this
->
assertEquals
(
count
(
$this
->
_details
),
count
(
$this
->
_result
));
}
}
tests/Solarium/Result/Select/Debug/TimingPhaseTest.php
0 → 100644
View file @
eb5d6022
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*/
class
Solarium_Result_Select_Debug_TimingPhaseTest
extends
PHPUnit_Framework_TestCase
{
/**
* @var Solarium_Result_Select_Debug_TimingPhase
*/
protected
$_result
;
protected
$_name
,
$_time
,
$_timings
;
public
function
setUp
()
{
$this
->
_name
=
'dummy-name'
;
$this
->
_time
=
14
;
$this
->
_timings
=
array
(
'class1'
=>
1
,
'class2'
=>
3
);
$this
->
_result
=
new
Solarium_Result_Select_Debug_TimingPhase
(
$this
->
_name
,
$this
->
_time
,
$this
->
_timings
);
}
public
function
testGetTime
()
{
$this
->
assertEquals
(
$this
->
_time
,
$this
->
_result
->
getTime
()
);
}
public
function
testGetTiming
()
{
$this
->
assertEquals
(
$this
->
_timings
[
'class1'
],
$this
->
_result
->
getTiming
(
'class1'
)
);
}
public
function
testGetPhaseWithInvalidKey
()
{
$this
->
assertEquals
(
null
,
$this
->
_result
->
getTiming
(
'invalidkey'
)
);
}
public
function
testGetTimings
()
{
$this
->
assertEquals
(
$this
->
_timings
,
$this
->
_result
->
getTimings
()
);
}
public
function
testIterator
()
{
$items
=
array
();
foreach
(
$this
->
_result
AS
$key
=>
$item
)
{
$items
[
$key
]
=
$item
;
}
$this
->
assertEquals
(
$this
->
_timings
,
$items
);
}
public
function
testCount
()
{
$this
->
assertEquals
(
count
(
$this
->
_timings
),
count
(
$this
->
_result
));
}
}
tests/Solarium/Result/Select/Debug/TimingTest.php
0 → 100644
View file @
eb5d6022
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*/
class
Solarium_Result_Select_Debug_TimingTest
extends
PHPUnit_Framework_TestCase
{
/**
* @var Solarium_Result_Select_Debug_Timing
*/
protected
$_result
;
protected
$_time
,
$_phases
;
public
function
setUp
()
{
$this
->
_time
=
14
;
$this
->
_phases
=
array
(
'key1'
=>
'dummy1'
,
'key2'
=>
'dummy2'
);
$this
->
_result
=
new
Solarium_Result_Select_Debug_Timing
(
$this
->
_time
,
$this
->
_phases
);
}
public
function
testGetTime
()
{
$this
->
assertEquals
(
$this
->
_time
,
$this
->
_result
->
getTime
()
);
}
public
function
testGetPhase
()
{
$this
->
assertEquals
(
$this
->
_phases
[
'key1'
],
$this
->
_result
->
getPhase
(
'key1'
)
);
}
public
function
testGetPhaseWithInvalidKey
()
{
$this
->
assertEquals
(
null
,
$this
->
_result
->
getPhase
(
'invalidkey'
)
);
}
public
function
testGetPhases
()
{
$this
->
assertEquals
(
$this
->
_phases
,
$this
->
_result
->
getPhases
()
);
}
public
function
testIterator
()
{
$items
=
array
();
foreach
(
$this
->
_result
AS
$key
=>
$item
)
{
$items
[
$key
]
=
$item
;
}
$this
->
assertEquals
(
$this
->
_phases
,
$items
);
}
public
function
testCount
()
{
$this
->
assertEquals
(
count
(
$this
->
_phases
),
count
(
$this
->
_result
));
}
}
tests/Solarium/Result/Select/DebugTest.php
0 → 100644
View file @
eb5d6022
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*/
class
Solarium_Result_Select_DebugTest
extends
PHPUnit_Framework_TestCase
{
/**
* @var Solarium_Result_Select_Debug
*/
protected
$_result
;
protected
$_queryString
,
$_queryParser
,
$_otherQuery
,
$_explain
,
$_explainOther
,
$timing
;
public
function
setUp
()
{
$this
->
_queryString
=
'dummy-querystring'
;
$this
->
_parsedQuery
=
'dummy-parsed-qs'
;
$this
->
_queryParser
=
'dummy-parser'
;
$this
->
_otherQuery
=
'id:67'
;
$this
->
_explainData
=
array
(
'a'
=>
'dummy1'
,
'b'
=>
'dummy2'
);
$this
->
_explain
=
new
ArrayIterator
(
$this
->
_explainData
);
$this
->
_explainOther
=
'dummy-other'
;
$this
->
_timing
=
'dummy-timing'
;
$this
->
_result
=
new
Solarium_Result_Select_Debug
(
$this
->
_queryString
,
$this
->
_parsedQuery
,
$this
->
_queryParser
,
$this
->
_otherQuery
,
$this
->
_explain
,
$this
->
_explainOther
,
$this
->
_timing
);
}
public
function
testGetQueryString
()
{
$this
->
assertEquals
(
$this
->
_queryString
,
$this
->
_result
->
getQueryString
());
}
public
function
testGetParsedQuery
()
{
$this
->
assertEquals
(
$this
->
_parsedQuery
,
$this
->
_result
->
getParsedQuery
());
}
public
function
testGetQueryParser
()
{
$this
->
assertEquals
(
$this
->
_queryParser
,
$this
->
_result
->
getQueryParser
());
}
public
function
testGetOtherQuery
()
{
$this
->
assertEquals
(
$this
->
_otherQuery
,
$this
->
_result
->
getOtherQuery
());
}
public
function
testGetExplain
()
{
$this
->
assertEquals
(
$this
->
_explain
,
$this
->
_result
->
getExplain
());
}
public
function
testGetExplainOther
()
{
$this
->
assertEquals
(
$this
->
_explainOther
,
$this
->
_result
->
getExplainOther
());
}
public
function
testGetTiming
()
{
$this
->
assertEquals
(
$this
->
_timing
,
$this
->
_result
->
getTiming
());
}
public
function
testIterator
()
{
$items
=
array
();
foreach
(
$this
->
_result
AS
$key
=>
$item
)
{
$items
[
$key
]
=
$item
;
}
$this
->
assertEquals
(
$this
->
_explainData
,
$items
);
}
public
function
testCount
()
{
$this
->
assertEquals
(
count
(
$this
->
_explain
),
count
(
$this
->
_result
));
}
}
tests/Solarium/Result/SelectTest.php
View file @
eb5d6022
...
...
@@ -37,7 +37,8 @@ class Solarium_Result_SelectTest extends PHPUnit_Framework_TestCase
*/
protected
$_result
;
protected
$_numFound
,
$_docs
,
$_components
,
$_facetSet
,
$_moreLikeThis
,
$_highlighting
,
$_grouping
,
$_stats
;
protected
$_numFound
,
$_docs
,
$_components
,
$_facetSet
,
$_moreLikeThis
,
$_highlighting
,
$_grouping
,
$_stats
,
$_debug
;
public
function
setUp
()
{
...
...
@@ -54,6 +55,7 @@ class Solarium_Result_SelectTest extends PHPUnit_Framework_TestCase
$this
->
_grouping
=
'dummy-grouping-value'
;
$this
->
_spellcheck
=
'dummy-grouping-value'
;
$this
->
_stats
=
'dummy-stats-value'
;
$this
->
_debug
=
'dummy-debug-value'
;
$this
->
_components
=
array
(
Solarium_Query_Select
::
COMPONENT_FACETSET
=>
$this
->
_facetSet
,
...
...
@@ -62,6 +64,7 @@ class Solarium_Result_SelectTest extends PHPUnit_Framework_TestCase
Solarium_Query_Select
::
COMPONENT_GROUPING
=>
$this
->
_grouping
,
Solarium_Query_Select
::
COMPONENT_SPELLCHECK
=>
$this
->
_spellcheck
,
Solarium_Query_Select
::
COMPONENT_STATS
=>
$this
->
_stats
,
Solarium_Query_Select
::
COMPONENT_DEBUG
=>
$this
->
_debug
,
);
$this
->
_result
=
new
Solarium_Result_SelectDummy
(
1
,
12
,
$this
->
_numFound
,
$this
->
_docs
,
$this
->
_components
);
...
...
@@ -148,6 +151,14 @@ class Solarium_Result_SelectTest extends PHPUnit_Framework_TestCase
);
}
public
function
testGetDebug
()
{
$this
->
assertEquals
(
$this
->
_components
[
Solarium_Query_Select
::
COMPONENT_DEBUG
],
$this
->
_result
->
getDebug
()
);
}
public
function
testIterator
()
{
$docs
=
array
();
...
...
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