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
2ab3d9f1
Commit
2ab3d9f1
authored
Sep 27, 2011
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored sharding into a select query component
Improved testcoverage for spellcheck
parent
ab585d41
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
810 additions
and
264 deletions
+810
-264
library/Solarium/Client/RequestBuilder/Select.php
library/Solarium/Client/RequestBuilder/Select.php
+0
-7
library/Solarium/Client/RequestBuilder/Select/Component/DistributedSearch.php
...ent/RequestBuilder/Select/Component/DistributedSearch.php
+66
-0
library/Solarium/Query/Select.php
library/Solarium/Query/Select.php
+29
-143
library/Solarium/Query/Select/Component/DistributedSearch.php
...ary/Solarium/Query/Select/Component/DistributedSearch.php
+210
-0
library/Solarium/Query/Select/Component/Spellcheck.php
library/Solarium/Query/Select/Component/Spellcheck.php
+14
-14
tests/Solarium/Client/RequestBuilder/Select/Component/DistributedSearchTest.php
...RequestBuilder/Select/Component/DistributedSearchTest.php
+59
-0
tests/Solarium/Client/RequestBuilder/Select/Component/SpellcheckTest.php
...Client/RequestBuilder/Select/Component/SpellcheckTest.php
+79
-0
tests/Solarium/Client/RequestBuilder/SelectTest.php
tests/Solarium/Client/RequestBuilder/SelectTest.php
+1
-24
tests/Solarium/Query/Select/Component/DistributedSearchTest.php
...Solarium/Query/Select/Component/DistributedSearchTest.php
+138
-0
tests/Solarium/Query/Select/Component/SpellcheckTest.php
tests/Solarium/Query/Select/Component/SpellcheckTest.php
+192
-0
tests/Solarium/Query/SelectTest.php
tests/Solarium/Query/SelectTest.php
+10
-74
tests/Solarium/Result/SelectTest.php
tests/Solarium/Result/SelectTest.php
+12
-2
No files found.
library/Solarium/Client/RequestBuilder/Select.php
View file @
2ab3d9f1
...
...
@@ -63,13 +63,6 @@ class Solarium_Client_RequestBuilder_Select extends Solarium_Client_RequestBuild
$request
->
addParam
(
'fl'
,
implode
(
','
,
$query
->
getFields
()));
$request
->
addParam
(
'wt'
,
'json'
);
// add shard fields to request
$shards
=
array_values
(
$query
->
getShards
());
if
(
count
(
$shards
))
{
$request
->
addParam
(
'shards'
,
implode
(
','
,
$shards
));
}
$request
->
addParam
(
'shards.qt'
,
$query
->
getShardRequestHandler
());
// add sort fields to request
$sort
=
array
();
foreach
(
$query
->
getSorts
()
AS
$field
=>
$order
)
{
...
...
library/Solarium/Client/RequestBuilder/Select/Component/DistributedSearch.php
0 → 100644
View file @
2ab3d9f1
<?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 distributedsearch to the request
*
* @package Solarium
* @subpackage Client
*/
class
Solarium_Client_RequestBuilder_Select_Component_DistributedSearch
{
/**
* Add request settings for DistributedSearch
*
* @param Solarium_Query_Select_Component_DistributedSearch $component
* @param Solarium_Client_Request $request
* @return Solarium_Client_Request
*/
public
function
build
(
$component
,
$request
)
{
// add shard fields to request
$shards
=
array_values
(
$component
->
getShards
());
if
(
count
(
$shards
))
{
$request
->
addParam
(
'shards'
,
implode
(
','
,
$shards
));
}
$request
->
addParam
(
'shards.qt'
,
$component
->
getShardRequestHandler
());
return
$request
;
}
}
\ No newline at end of file
library/Solarium/Query/Select.php
View file @
2ab3d9f1
...
...
@@ -89,6 +89,11 @@ class Solarium_Query_Select extends Solarium_Query
*/
const
COMPONENT_GROUPING
=
'grouping'
;
/**
* Query component distributed search
*/
const
COMPONENT_DISTRIBUTEDSEARCH
=
'distributedsearch'
;
/**
* Get type for this query
*
...
...
@@ -101,7 +106,7 @@ class Solarium_Query_Select extends Solarium_Query
/**
* Default options
*
*
* @var array
*/
protected
$_options
=
array
(
...
...
@@ -116,7 +121,7 @@ class Solarium_Query_Select extends Solarium_Query
/**
* Default select query component types
*
*
* @var array
*/
protected
$_componentTypes
=
array
(
...
...
@@ -150,6 +155,11 @@ class Solarium_Query_Select extends Solarium_Query
'requestbuilder'
=>
'Solarium_Client_RequestBuilder_Select_Component_Spellcheck'
,
'responseparser'
=>
'Solarium_Client_ResponseParser_Select_Component_Spellcheck'
,
),
self
::
COMPONENT_DISTRIBUTEDSEARCH
=>
array
(
'component'
=>
'Solarium_Query_Select_Component_DistributedSearch'
,
'requestbuilder'
=>
'Solarium_Client_RequestBuilder_Select_Component_DistributedSearch'
,
'responseparser'
=>
null
,
),
);
/**
...
...
@@ -166,13 +176,6 @@ class Solarium_Query_Select extends Solarium_Query
*/
protected
$_sorts
=
array
();
/**
* Request to be distributed across all shards in the list
*
* @var array
*/
protected
$_shards
=
array
();
/**
* Filterqueries
*
...
...
@@ -192,7 +195,7 @@ class Solarium_Query_Select extends Solarium_Query
*
* Several options need some extra checks or setup work, for these options
* the setters are called.
*
*
* @return void
*/
protected
function
_init
()
...
...
@@ -217,9 +220,6 @@ class Solarium_Query_Select extends Solarium_Query
case
'start'
:
$this
->
setStart
((
int
)
$value
);
break
;
case
'shards'
:
$this
->
setShards
(
$value
);
break
;
case
'component'
:
$this
->
_createComponents
(
$value
);
break
;
...
...
@@ -315,7 +315,7 @@ class Solarium_Query_Select extends Solarium_Query
* Get the current documentclass option
*
* The value is a classname, not an instance
*
*
* @return string
*/
public
function
getDocumentClass
()
...
...
@@ -513,132 +513,6 @@ class Solarium_Query_Select extends Solarium_Query
return
$this
;
}
/**
* Add a shard
*
* @param string $key unique string
* @param string $shard The syntax is host:port/base_url
* @return Solarium_Query_Select Provides fluent interface
* @link http://wiki.apache.org/solr/DistributedSearch
*/
public
function
addShard
(
$key
,
$shard
)
{
$this
->
_shards
[
$key
]
=
$shard
;
return
$this
;
}
/**
* Add multiple shards
*
* Example usage:
* <code>
* $client = new Solarium_Client;
* $query = $client->createSelect();
* $query->addShards(array(
* 'core0' => 'localhost:8983/solr/core0',
* 'core1' => 'localhost:8983/solr/core1'
* ));
* $result = $client->select($query);
* </code>
* @param array $shards
* @return Solarium_Query_Select Provides fluent interface
*/
public
function
addShards
(
array
$shards
)
{
foreach
(
$shards
as
$key
=>
$shard
)
{
$this
->
addShard
(
$key
,
$shard
);
}
return
$this
;
}
/**
* Remove a shard
*
* @param string $key
* @return Solarium_Query_Select Provides fluent interface
*/
public
function
removeShard
(
$key
)
{
if
(
isset
(
$this
->
_shards
[
$key
]))
{
unset
(
$this
->
_shards
[
$key
]);
}
return
$this
;
}
/**
* Remove all shards
*
* @return Solarium_Query_Select Provides fluent interface
*/
public
function
clearShards
()
{
$this
->
_shards
=
array
();
return
$this
;
}
/**
* Set multiple shards
*
* This overwrites any existing shards
*
* Example usage:
* <code>
* $client = new Solarium_Client;
* $query = $client->createSelect();
* $query->setShards(array(
* 'core0' => 'localhost:8983/solr/core0',
* 'core1' => 'localhost:8983/solr/core1'
* ));
* $result = $client->select($query);
* </code>
*
* @param array $shards Associative array of shards
* @return Solarium_Query_Select Provides fluent interface
*/
public
function
setShards
(
array
$shards
)
{
$this
->
clearShards
();
$this
->
addShards
(
$shards
);
return
$this
;
}
/**
* Get a list of the shards
*
* @return array
*/
public
function
getShards
()
{
return
$this
->
_shards
;
}
/**
* A sharded request will go to the standard request handler
* (not necessarily the original); this can be overridden via shards.qt
*
* @param string
* @return Solarium_Query_Select Provides fluent interface
*/
public
function
setShardRequestHandler
(
$handler
)
{
$this
->
_setOption
(
'shardhandler'
,
$handler
);
return
$this
;
}
/**
* Get a shard request handler (shards.qt)
*
* @param string
* @return Solarium_Query_Select Provides fluent interface
*/
public
function
getShardRequestHandler
()
{
return
$this
->
getOption
(
'shardhandler'
);
}
/**
* Create a filterquery instance
*
...
...
@@ -682,7 +556,7 @@ class Solarium_Query_Select extends Solarium_Query
if
(
is_array
(
$filterQuery
))
{
$filterQuery
=
new
Solarium_Query_Select_FilterQuery
(
$filterQuery
);
}
$key
=
$filterQuery
->
getKey
();
if
(
0
===
strlen
(
$key
))
{
...
...
@@ -826,7 +700,7 @@ class Solarium_Query_Select extends Solarium_Query
/**
* Get all registered components
*
*
* @return array
*/
public
function
getComponents
()
...
...
@@ -855,7 +729,7 @@ class Solarium_Query_Select extends Solarium_Query
if
(
!
isset
(
$this
->
_componentTypes
[
$key
]))
{
throw
new
Solarium_Exception
(
'Cannot autoload unknown component: '
.
$key
);
}
$className
=
$this
->
_componentTypes
[
$key
][
'component'
];
$component
=
new
$className
(
$config
);
$this
->
setComponent
(
$key
,
$component
);
...
...
@@ -992,4 +866,16 @@ class Solarium_Query_Select extends Solarium_Query
return
$this
->
getComponent
(
Solarium_Query_Select
::
COMPONENT_SPELLCHECK
,
true
);
}
/*
* Get a DistributedSearch component instance
*
* This is a convenience method that maps presets to getComponent
*
* @return Solarium_Query_Select_Component_DistributedSearch
*/
public
function
getDistributedSearch
()
{
return
$this
->
getComponent
(
Solarium_Query_Select
::
COMPONENT_DISTRIBUTEDSEARCH
,
true
);
}
}
library/Solarium/Query/Select/Component/DistributedSearch.php
0 → 100644
View file @
2ab3d9f1
<?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
*/
/**
* Distributed Search (sharding) component
*
* @link http://wiki.apache.org/solr/DistributedSearch
*
* @package Solarium
* @subpackage Query
*/
class
Solarium_Query_Select_Component_DistributedSearch
extends
Solarium_Query_Select_Component
{
/**
* Component type
*
* @var string
*/
protected
$_type
=
Solarium_Query_Select
::
COMPONENT_DISTRIBUTEDSEARCH
;
/**
* Request to be distributed across all shards in the list
*
* @var array
*/
protected
$_shards
=
array
();
/**
* Initialize options
*
* Several options need some extra checks or setup work, for these options
* the setters are called.
*
* @return void
*/
protected
function
_init
()
{
foreach
(
$this
->
_options
AS
$name
=>
$value
)
{
switch
(
$name
)
{
case
'shards'
:
$this
->
setShards
(
$value
);
break
;
}
}
}
/**
* Add a shard
*
* @param string $key unique string
* @param string $shard The syntax is host:port/base_url
* @return Solarium_Query_Select Provides fluent interface
* @link http://wiki.apache.org/solr/DistributedSearch
*/
public
function
addShard
(
$key
,
$shard
)
{
$this
->
_shards
[
$key
]
=
$shard
;
return
$this
;
}
/**
* Add multiple shards
*
* Example usage:
* <code>
* $client = new Solarium_Client;
* $query = $client->createSelect();
* $distributedSearch = $query->getDistributedSearch();
* $distributedSearch->addShards(array(
* 'core0' => 'localhost:8983/solr/core0',
* 'core1' => 'localhost:8983/solr/core1'
* ));
* $result = $client->select($query);
* </code>
* @param array $shards
* @return Solarium_Query_Select Provides fluent interface
*/
public
function
addShards
(
array
$shards
)
{
foreach
(
$shards
as
$key
=>
$shard
)
{
$this
->
addShard
(
$key
,
$shard
);
}
return
$this
;
}
/**
* Remove a shard
*
* @param string $key
* @return Solarium_Query_Select Provides fluent interface
*/
public
function
removeShard
(
$key
)
{
if
(
isset
(
$this
->
_shards
[
$key
]))
{
unset
(
$this
->
_shards
[
$key
]);
}
return
$this
;
}
/**
* Remove all shards
*
* @return Solarium_Query_Select Provides fluent interface
*/
public
function
clearShards
()
{
$this
->
_shards
=
array
();
return
$this
;
}
/**
* Set multiple shards
*
* This overwrites any existing shards
*
* Example usage:
* <code>
* $client = new Solarium_Client;
* $query = $client->createSelect();
* $distributedSearch = $query->getDistributedSearch();
* $distributedSearch->setShards(array(
* 'core0' => 'localhost:8983/solr/core0',
* 'core1' => 'localhost:8983/solr/core1'
* ));
* $result = $client->select($query);
* </code>
*
* @param array $shards Associative array of shards
* @return Solarium_Query_Select Provides fluent interface
*/
public
function
setShards
(
array
$shards
)
{
$this
->
clearShards
();
$this
->
addShards
(
$shards
);
return
$this
;
}
/**
* Get a list of the shards
*
* @return array
*/
public
function
getShards
()
{
return
$this
->
_shards
;
}
/**
* A sharded request will go to the standard request handler
* (not necessarily the original); this can be overridden via shards.qt
*
* @param string
* @return Solarium_Query_Select Provides fluent interface
*/
public
function
setShardRequestHandler
(
$handler
)
{
$this
->
_setOption
(
'shardhandler'
,
$handler
);
return
$this
;
}
/**
* Get a shard request handler (shards.qt)
*
* @param string
* @return Solarium_Query_Select Provides fluent interface
*/
public
function
getShardRequestHandler
()
{
return
$this
->
getOption
(
'shardhandler'
);
}
}
\ No newline at end of file
library/Solarium/Query/Select/Component/Spellcheck.php
View file @
2ab3d9f1
...
...
@@ -40,7 +40,7 @@
* Spellcheck component
*
* @link http://wiki.apache.org/solr/SpellCheckComponent
*
*
* @package Solarium
* @subpackage Query
*/
...
...
@@ -48,7 +48,7 @@ class Solarium_Query_Select_Component_Spellcheck extends Solarium_Query_Select_C
{
/**
* Component type
*
*
* @var string
*/
protected
$_type
=
Solarium_Query_Select
::
COMPONENT_SPELLCHECK
;
...
...
@@ -81,7 +81,7 @@ class Solarium_Query_Select_Component_Spellcheck extends Solarium_Query_Select_C
*
* Build the spellcheck?
*
* @param
string
$build
* @param
boolean
$build
* @return Solarium_Query_Select_Component_Spellcheck Provides fluent interface
*/
public
function
setBuild
(
$build
)
...
...
@@ -92,7 +92,7 @@ class Solarium_Query_Select_Component_Spellcheck extends Solarium_Query_Select_C
/**
* Get build option
*
* @return
string
|null
* @return
boolean
|null
*/
public
function
getBuild
()
{
...
...
@@ -104,7 +104,7 @@ class Solarium_Query_Select_Component_Spellcheck extends Solarium_Query_Select_C
*
* Reload the dictionary?
*
* @param
string
$reload
* @param
boolean
$reload
* @return Solarium_Query_Select_Component_Spellcheck Provides fluent interface
*/
public
function
setReload
(
$reload
)
...
...
@@ -115,7 +115,7 @@ class Solarium_Query_Select_Component_Spellcheck extends Solarium_Query_Select_C
/**
* Get fragsize option
*
* @return
string
|null
* @return
boolean
|null
*/
public
function
getReload
()
{
...
...
@@ -149,7 +149,7 @@ class Solarium_Query_Select_Component_Spellcheck extends Solarium_Query_Select_C
* Set count option
*
* The maximum number of suggestions to return
*
*
* @param int $count
* @return Solarium_Query_Select_Component_Spellcheck Provides fluent interface
*/
...
...
@@ -173,7 +173,7 @@ class Solarium_Query_Select_Component_Spellcheck extends Solarium_Query_Select_C
*
* Only return suggestions that result in more hits for the query than the existing query
*
* @param
string
$onlyMorePopular
* @param
boolean
$onlyMorePopular
* @return Solarium_Query_Select_Component_Spellcheck Provides fluent interface
*/
public
function
setOnlyMorePopular
(
$onlyMorePopular
)
...
...
@@ -184,7 +184,7 @@ class Solarium_Query_Select_Component_Spellcheck extends Solarium_Query_Select_C
/**
* Get onlyMorePopular option
*
* @return
string
|null
* @return
boolean
|null
*/
public
function
getOnlyMorePopular
()
{
...
...
@@ -194,7 +194,7 @@ class Solarium_Query_Select_Component_Spellcheck extends Solarium_Query_Select_C
/**
* Set extendedResults option
*
* @param
string
$extendedResults
* @param
boolean
$extendedResults
* @return Solarium_Query_Select_Component_Spellcheck Provides fluent interface
*/
public
function
setExtendedResults
(
$extendedResults
)
...
...
@@ -205,7 +205,7 @@ class Solarium_Query_Select_Component_Spellcheck extends Solarium_Query_Select_C
/**
* Get extendedResults option
*
* @return
string
|null
* @return
boolean
|null
*/
public
function
getExtendedResults
()
{
...
...
@@ -215,7 +215,7 @@ class Solarium_Query_Select_Component_Spellcheck extends Solarium_Query_Select_C
/**
* Set collate option
*
* @param
string
$collate
* @param
boolean
$collate
* @return Solarium_Query_Select_Component_Spellcheck Provides fluent interface
*/
public
function
setCollate
(
$collate
)
...
...
@@ -226,7 +226,7 @@ class Solarium_Query_Select_Component_Spellcheck extends Solarium_Query_Select_C
/**
* Get collate option
*
* @return
string
|null
* @return
boolean
|null
*/
public
function
getCollate
()
{
...
...
@@ -337,5 +337,5 @@ class Solarium_Query_Select_Component_Spellcheck extends Solarium_Query_Select_C
{
return
$this
->
getOption
(
'accuracy'
);
}
}
\ No newline at end of file
tests/Solarium/Client/RequestBuilder/Select/Component/DistributedSearchTest.php
0 → 100644
View file @
2ab3d9f1
<?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_DistributedSearchTest
extends
PHPUnit_Framework_TestCase
{
public
function
testBuild
()
{
$builder
=
new
Solarium_Client_RequestBuilder_Select_Component_DistributedSearch
;
$request
=
new
Solarium_Client_Request
();
$component
=
new
Solarium_Query_Select_Component_DistributedSearch
();
$component
->
addShard
(
'shard1'
,
'localhost:8983/solr/shard1'
);
$component
->
addShards
(
array
(
'shard2'
=>
'localhost:8983/solr/shard2'
,
'shard3'
=>
'localhost:8983/solr/shard3'
));
$component
->
setShardRequestHandler
(
'dummy'
);
$request
=
$builder
->
build
(
$component
,
$request
);
$this
->
assertEquals
(
array
(
'shards.qt'
=>
'dummy'
,
'shards'
=>
'localhost:8983/solr/shard1,localhost:8983/solr/shard2,localhost:8983/solr/shard3'
,
),
$request
->
getParams
()
);
}
}
\ No newline at end of file
tests/Solarium/Client/RequestBuilder/Select/Component/SpellcheckTest.php
0 → 100644
View file @
2ab3d9f1
<?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_SpellcheckTest
extends
PHPUnit_Framework_TestCase
{
public
function
testBuild
()
{
$builder
=
new
Solarium_Client_RequestBuilder_Select_Component_Spellcheck
();
$request
=
new
Solarium_Client_Request
();
$component
=
new
Solarium_Query_Select_Component_Spellcheck
();
$component
->
setQuery
(
'testquery'
);
$component
->
setBuild
(
false
);
$component
->
setReload
(
true
);
$component
->
setDictionary
(
'testdict'
);
$component
->
setCount
(
3
);
$component
->
setOnlyMorePopular
(
false
);
$component
->
setExtendedResults
(
true
);
$component
->
setCollate
(
true
);
$component
->
setMaxCollations
(
2
);
$component
->
setMaxCollationTries
(
4
);
$component
->
setMaxCollationEvaluations
(
4
);
$component
->
setCollateExtendedResults
(
true
);
$component
->
setAccuracy
(
.
2
);
$request
=
$builder
->
build
(
$component
,
$request
);
$this
->
assertEquals
(
array
(
'spellcheck'
=>
'true'
,
'spellcheck.q'
=>
'testquery'
,
'spellcheck.build'
=>
'false'
,
'spellcheck.reload'
=>
'true'
,
'spellcheck.dictionary'
=>
'testdict'
,
'spellcheck.count'
=>
3
,
'spellcheck.onlyMorePopular'
=>
'false'
,
'spellcheck.extendedResults'
=>
'true'
,
'spellcheck.collate'
=>
'true'
,
'spellcheck.maxCollations'
=>
2
,
'spellcheck.maxCollationTries'
=>
4
,
'spellcheck.maxCollationEvaluations'
=>
4
,
'spellcheck.collateExtendedResults'
=>
'true'
,
'spellcheck.accuracy'
=>
.
2
,
),
$request
->
getParams
()
);
}
}
\ No newline at end of file
tests/Solarium/Client/RequestBuilder/SelectTest.php
View file @
2ab3d9f1
...
...
@@ -89,29 +89,6 @@ class Solarium_Client_RequestBuilder_SelectTest extends PHPUnit_Framework_TestCa
);
}
public
function
testSelectUrlWithShard
()
{
$this
->
_query
->
addShard
(
'shard1'
,
'localhost:8983/solr/shard1'
);
$this
->
_query
->
addShards
(
array
(
'shard2'
=>
'localhost:8983/solr/shard2'
,
'shard3'
=>
'localhost:8983/solr/shard3'
));
$this
->
_query
->
setShardRequestHandler
(
'dummy'
);
$request
=
$this
->
_builder
->
build
(
$this
->
_query
);
$this
->
assertEquals
(
null
,
$request
->
getRawData
()
);
$this
->
assertEquals
(
'select?q=*:*&start=0&rows=10&fl=*,score&wt=json'
.
'&shards=localhost:8983/solr/shard1,localhost:8983/solr/shard2,localhost:8983/solr/shard3'
.
'&shards.qt=dummy'
,
urldecode
(
$request
->
getUri
())
);
}
public
function
testSelectUrlWithSortAndFilters
()
{
$this
->
_query
->
addSort
(
'id'
,
Solarium_Query_Select
::
SORT_ASC
);
...
...
@@ -156,7 +133,7 @@ class Solarium_Client_RequestBuilder_SelectTest extends PHPUnit_Framework_TestCa
$request
->
getParam
(
'defType'
)
);
}
}
class
TestDummyComponent
extends
Solarium_Query_Select_Component
{
...
...
tests/Solarium/Query/Select/Component/DistributedSearchTest.php
0 → 100644
View file @
2ab3d9f1
<?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_DistributedSearchTest
extends
PHPUnit_Framework_TestCase
{
/**
* @var Solarium_Query_Select_Component_DistributedSearch
*/
protected
$_distributedSearch
;
public
function
setUp
()
{
$this
->
_distributedSearch
=
new
Solarium_Query_Select_Component_DistributedSearch
;
}
public
function
testConfigMode
()
{
$options
=
array
(
'shardhandler'
=>
'dummyhandler'
,
'shards'
=>
array
(
'shard1'
=>
'localhost:8983/solr/shard1'
,
'shard2'
=>
'localhost:8983/solr/shard2'
,
)
);
$this
->
_distributedSearch
->
setOptions
(
$options
);
$this
->
assertEquals
(
$options
[
'shardhandler'
],
$this
->
_distributedSearch
->
getShardRequestHandler
());
$this
->
assertEquals
(
$options
[
'shards'
],
$this
->
_distributedSearch
->
getShards
());
}
public
function
testGetType
()
{
$this
->
assertEquals
(
Solarium_Query_Select
::
COMPONENT_DISTRIBUTEDSEARCH
,
$this
->
_distributedSearch
->
getType
()
);
}
public
function
testAddShard
()
{
$this
->
_distributedSearch
->
addShard
(
'shard1'
,
'localhost:8983/solr/shard1'
);
$shards
=
$this
->
_distributedSearch
->
getShards
();
$this
->
assertEquals
(
'localhost:8983/solr/shard1'
,
$shards
[
'shard1'
]
);
}
public
function
testRemoveShard
()
{
$this
->
_distributedSearch
->
addShard
(
'shard1'
,
'localhost:8983/solr/shard1'
);
$this
->
_distributedSearch
->
removeShard
(
'shard1'
);
$shards
=
$this
->
_distributedSearch
->
getShards
();
$this
->
assertFalse
(
isset
(
$shards
[
'shard1'
]));
}
public
function
testClearShards
()
{
$this
->
_distributedSearch
->
addShards
(
array
(
'shard1'
=>
'localhost:8983/solr/shard1'
,
'shard2'
=>
'localhost:8983/solr/shard2'
,
));
$this
->
_distributedSearch
->
clearShards
();
$shards
=
$this
->
_distributedSearch
->
getShards
();
$this
->
assertTrue
(
is_array
(
$shards
));
$this
->
assertEquals
(
0
,
count
(
$shards
));
}
public
function
testAddShards
()
{
$shards
=
array
(
'shard1'
=>
'localhost:8983/solr/shard1'
,
'shard2'
=>
'localhost:8983/solr/shard2'
,
);
$this
->
_distributedSearch
->
addShards
(
$shards
);
$this
->
assertEquals
(
$shards
,
$this
->
_distributedSearch
->
getShards
());
}
public
function
testSetShards
()
{
$this
->
_distributedSearch
->
addShards
(
array
(
'shard1'
=>
'localhost:8983/solr/shard1'
,
'shard2'
=>
'localhost:8983/solr/shard2'
,
));
$this
->
_distributedSearch
->
setShards
(
array
(
'shard3'
=>
'localhost:8983/solr/shard3'
,
'shard4'
=>
'localhost:8983/solr/shard4'
,
'shard5'
=>
'localhost:8983/solr/shard5'
,
));
$shards
=
$this
->
_distributedSearch
->
getShards
();
$this
->
assertEquals
(
3
,
count
(
$shards
));
$this
->
assertEquals
(
array
(
'shard3'
=>
'localhost:8983/solr/shard3'
,
'shard4'
=>
'localhost:8983/solr/shard4'
,
'shard5'
=>
'localhost:8983/solr/shard5'
,
),
$shards
);
}
public
function
testSetShardRequestHandler
()
{
$this
->
_distributedSearch
->
setShardRequestHandler
(
'dummy'
);
$this
->
assertEquals
(
'dummy'
,
$this
->
_distributedSearch
->
getShardRequestHandler
()
);
}
}
tests/Solarium/Query/Select/Component/SpellcheckTest.php
0 → 100644
View file @
2ab3d9f1
<?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_SpellcheckTest
extends
PHPUnit_Framework_TestCase
{
/**
* @var Solarium_Query_Select_Component_Spellcheck
*/
protected
$_spellCheck
;
public
function
setUp
()
{
$this
->
_spellCheck
=
new
Solarium_Query_Select_Component_Spellcheck
;
}
public
function
testGetType
()
{
$this
->
assertEquals
(
Solarium_Query_Select
::
COMPONENT_SPELLCHECK
,
$this
->
_spellCheck
->
getType
());
}
public
function
testSetAndGetQuery
()
{
$value
=
'testquery'
;
$this
->
_spellCheck
->
setQuery
(
$value
);
$this
->
assertEquals
(
$value
,
$this
->
_spellCheck
->
getQuery
()
);
}
public
function
testSetAndGetBuild
()
{
$value
=
true
;
$this
->
_spellCheck
->
setBuild
(
$value
);
$this
->
assertEquals
(
$value
,
$this
->
_spellCheck
->
getBuild
()
);
}
public
function
testSetAndGetReload
()
{
$value
=
false
;
$this
->
_spellCheck
->
setReload
(
$value
);
$this
->
assertEquals
(
$value
,
$this
->
_spellCheck
->
getReload
()
);
}
public
function
testSetAndGetDictionary
()
{
$value
=
'myDictionary'
;
$this
->
_spellCheck
->
setDictionary
(
$value
);
$this
->
assertEquals
(
$value
,
$this
->
_spellCheck
->
getDictionary
()
);
}
public
function
testSetAndGetCount
()
{
$value
=
11
;
$this
->
_spellCheck
->
setCount
(
$value
);
$this
->
assertEquals
(
$value
,
$this
->
_spellCheck
->
getCount
()
);
}
public
function
testSetAndGetOnlyMorePopular
()
{
$value
=
false
;
$this
->
_spellCheck
->
setOnlyMorePopular
(
$value
);
$this
->
assertEquals
(
$value
,
$this
->
_spellCheck
->
getOnlyMorePopular
()
);
}
public
function
testSetAndGetExtendedResults
()
{
$value
=
false
;
$this
->
_spellCheck
->
setExtendedResults
(
$value
);
$this
->
assertEquals
(
$value
,
$this
->
_spellCheck
->
getExtendedResults
()
);
}
public
function
testSetAndGetCollate
()
{
$value
=
false
;
$this
->
_spellCheck
->
setCollate
(
$value
);
$this
->
assertEquals
(
$value
,
$this
->
_spellCheck
->
getCollate
()
);
}
public
function
testSetAndGetMaxCollations
()
{
$value
=
23
;
$this
->
_spellCheck
->
setMaxCollations
(
$value
);
$this
->
assertEquals
(
$value
,
$this
->
_spellCheck
->
getMaxCollations
()
);
}
public
function
testSetAndGetMaxCollationTries
()
{
$value
=
10
;
$this
->
_spellCheck
->
setMaxCollationTries
(
$value
);
$this
->
assertEquals
(
$value
,
$this
->
_spellCheck
->
getMaxCollationTries
()
);
}
public
function
testSetAndGetMaxCollationEvaluations
()
{
$value
=
10
;
$this
->
_spellCheck
->
setMaxCollationEvaluations
(
$value
);
$this
->
assertEquals
(
$value
,
$this
->
_spellCheck
->
getMaxCollationEvaluations
()
);
}
public
function
testSetAndGetCollateExtendedResults
()
{
$value
=
true
;
$this
->
_spellCheck
->
setCollateExtendedResults
(
$value
);
$this
->
assertEquals
(
$value
,
$this
->
_spellCheck
->
getCollateExtendedResults
()
);
}
public
function
testSetAndGetAccuracy
()
{
$value
=
.
1
;
$this
->
_spellCheck
->
setAccuracy
(
$value
);
$this
->
assertEquals
(
$value
,
$this
->
_spellCheck
->
getAccuracy
()
);
}
}
tests/Solarium/Query/SelectTest.php
View file @
2ab3d9f1
...
...
@@ -210,75 +210,6 @@ class Solarium_Query_SelectTest extends PHPUnit_Framework_TestCase
);
}
public
function
testAddShard
()
{
$this
->
_query
->
addShard
(
'shard1'
,
'localhost:8983/solr/shard1'
);
$shards
=
$this
->
_query
->
getShards
();
$this
->
assertEquals
(
'localhost:8983/solr/shard1'
,
$shards
[
'shard1'
]
);
}
public
function
testRemoveShard
()
{
$this
->
_query
->
addShard
(
'shard1'
,
'localhost:8983/solr/shard1'
);
$this
->
_query
->
removeShard
(
'shard1'
);
$shards
=
$this
->
_query
->
getShards
();
$this
->
assertFalse
(
isset
(
$shards
[
'shard1'
]));
}
public
function
testClearShards
()
{
$this
->
_query
->
addShards
(
array
(
'shard1'
=>
'localhost:8983/solr/shard1'
,
'shard2'
=>
'localhost:8983/solr/shard2'
,
));
$this
->
_query
->
clearShards
();
$shards
=
$this
->
_query
->
getShards
();
$this
->
assertTrue
(
is_array
(
$shards
));
$this
->
assertEquals
(
0
,
count
(
$shards
));
}
public
function
testAddShards
()
{
$shards
=
array
(
'shard1'
=>
'localhost:8983/solr/shard1'
,
'shard2'
=>
'localhost:8983/solr/shard2'
,
);
$this
->
_query
->
addShards
(
$shards
);
$this
->
assertEquals
(
$shards
,
$this
->
_query
->
getShards
());
}
public
function
testSetShards
()
{
$this
->
_query
->
addShards
(
array
(
'shard1'
=>
'localhost:8983/solr/shard1'
,
'shard2'
=>
'localhost:8983/solr/shard2'
,
));
$this
->
_query
->
setShards
(
array
(
'shard3'
=>
'localhost:8983/solr/shard3'
,
'shard4'
=>
'localhost:8983/solr/shard4'
,
'shard5'
=>
'localhost:8983/solr/shard5'
,
));
$shards
=
$this
->
_query
->
getShards
();
$this
->
assertEquals
(
3
,
count
(
$shards
));
$this
->
assertEquals
(
array
(
'shard3'
=>
'localhost:8983/solr/shard3'
,
'shard4'
=>
'localhost:8983/solr/shard4'
,
'shard5'
=>
'localhost:8983/solr/shard5'
,
),
$shards
);
}
public
function
testSetShardRequestHandler
()
{
$this
->
_query
->
setShardRequestHandler
(
'dummy'
);
$this
->
assertEquals
(
'dummy'
,
$this
->
_query
->
getShardRequestHandler
()
);
}
public
function
testAddAndGetFilterQuery
()
{
$fq
=
new
Solarium_Query_Select_FilterQuery
;
...
...
@@ -464,10 +395,6 @@ class Solarium_Query_SelectTest extends PHPUnit_Framework_TestCase
'fields'
=>
array
(
'id'
,
'title'
,
'category'
),
'rows'
=>
100
,
'start'
=>
200
,
'shards'
=>
array
(
'shard1'
=>
'localhost:8983/solr/shard1'
,
'shard2'
=>
'localhost:8983/solr/shard2'
,
),
'filterquery'
=>
array
(
array
(
'key'
=>
'pub'
,
'tag'
=>
array
(
'pub'
),
'query'
=>
'published:true'
),
'online'
=>
array
(
'tag'
=>
'onl'
,
'query'
=>
'online:true'
)
...
...
@@ -490,7 +417,6 @@ class Solarium_Query_SelectTest extends PHPUnit_Framework_TestCase
$this
->
assertEquals
(
$config
[
'fields'
],
$query
->
getFields
());
$this
->
assertEquals
(
$config
[
'rows'
],
$query
->
getRows
());
$this
->
assertEquals
(
$config
[
'start'
],
$query
->
getStart
());
$this
->
assertEquals
(
$config
[
'shards'
],
$query
->
getShards
());
$this
->
assertEquals
(
$config
[
'documentclass'
],
$query
->
getDocumentClass
());
$this
->
assertEquals
(
$config
[
'resultclass'
],
$query
->
getResultClass
());
$this
->
assertEquals
(
'published:true'
,
$query
->
getFilterQuery
(
'pub'
)
->
getQuery
());
...
...
@@ -665,4 +591,14 @@ class Solarium_Query_SelectTest extends PHPUnit_Framework_TestCase
get_class
(
$spellcheck
)
);
}
public
function
testGetDistributedSearch
()
{
$spellcheck
=
$this
->
_query
->
getDistributedSearch
();
$this
->
assertEquals
(
'Solarium_Query_Select_Component_DistributedSearch'
,
get_class
(
$spellcheck
)
);
}
}
tests/Solarium/Result/SelectTest.php
View file @
2ab3d9f1
...
...
@@ -52,12 +52,14 @@ class Solarium_Result_SelectTest extends PHPUnit_Framework_TestCase
$this
->
_moreLikeThis
=
'dummy-facetset-value'
;
$this
->
_highlighting
=
'dummy-highlighting-value'
;
$this
->
_grouping
=
'dummy-grouping-value'
;
$this
->
_spellcheck
=
'dummy-grouping-value'
;
$this
->
_components
=
array
(
Solarium_Query_Select
::
COMPONENT_FACETSET
=>
$this
->
_facetSet
,
Solarium_Query_Select
::
COMPONENT_MORELIKETHIS
=>
$this
->
_moreLikeThis
,
Solarium_Query_Select
::
COMPONENT_HIGHLIGHTING
=>
$this
->
_highlighting
,
Solarium_Query_Select
::
COMPONENT_GROUPING
=>
$this
->
_grouping
Solarium_Query_Select
::
COMPONENT_GROUPING
=>
$this
->
_grouping
,
Solarium_Query_Select
::
COMPONENT_SPELLCHECK
=>
$this
->
_spellcheck
,
);
$this
->
_result
=
new
Solarium_Result_SelectDummy
(
1
,
12
,
$this
->
_numFound
,
$this
->
_docs
,
$this
->
_components
);
...
...
@@ -128,6 +130,14 @@ class Solarium_Result_SelectTest extends PHPUnit_Framework_TestCase
);
}
public
function
testGetSpellcheck
()
{
$this
->
assertEquals
(
$this
->
_components
[
Solarium_Query_Select
::
COMPONENT_SPELLCHECK
],
$this
->
_result
->
getSpellcheck
()
);
}
public
function
testIterator
()
{
$docs
=
array
();
...
...
@@ -154,7 +164,7 @@ class Solarium_Result_SelectTest extends PHPUnit_Framework_TestCase
$this
->
_result
->
getQueryTime
()
);
}
}
class
Solarium_Result_SelectDummy
extends
Solarium_Result_Select
...
...
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