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
981af911
Commit
981af911
authored
Sep 10, 2012
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved return types. Fixed spellcheck parsing for multiple collations.
parent
43d502ca
Changes
28
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
105 additions
and
56 deletions
+105
-56
library/Solarium/Core/Client/Adapter/Curl.php
library/Solarium/Core/Client/Adapter/Curl.php
+1
-1
library/Solarium/Core/Client/Client.php
library/Solarium/Core/Client/Client.php
+2
-2
library/Solarium/Core/Query/ResponseParser.php
library/Solarium/Core/Query/ResponseParser.php
+16
-1
library/Solarium/Plugin/BufferedAdd/BufferedAdd.php
library/Solarium/Plugin/BufferedAdd/BufferedAdd.php
+4
-3
library/Solarium/Plugin/BufferedAdd/Event/PostCommit.php
library/Solarium/Plugin/BufferedAdd/Event/PostCommit.php
+2
-1
library/Solarium/Plugin/BufferedAdd/Event/PostFlush.php
library/Solarium/Plugin/BufferedAdd/Event/PostFlush.php
+2
-1
library/Solarium/Plugin/BufferedAdd/Event/PreCommit.php
library/Solarium/Plugin/BufferedAdd/Event/PreCommit.php
+2
-1
library/Solarium/Plugin/BufferedAdd/Event/PreFlush.php
library/Solarium/Plugin/BufferedAdd/Event/PreFlush.php
+2
-1
library/Solarium/Plugin/CustomizeRequest/CustomizeRequest.php
...ary/Solarium/Plugin/CustomizeRequest/CustomizeRequest.php
+1
-1
library/Solarium/Plugin/Loadbalancer/Loadbalancer.php
library/Solarium/Plugin/Loadbalancer/Loadbalancer.php
+1
-1
library/Solarium/Plugin/ParallelExecution/ParallelExecution.php
...y/Solarium/Plugin/ParallelExecution/ParallelExecution.php
+3
-2
library/Solarium/QueryType/Analysis/Query/Document.php
library/Solarium/QueryType/Analysis/Query/Document.php
+3
-2
library/Solarium/QueryType/Analysis/ResponseParser/Document.php
...y/Solarium/QueryType/Analysis/ResponseParser/Document.php
+3
-2
library/Solarium/QueryType/Analysis/ResponseParser/Field.php
library/Solarium/QueryType/Analysis/ResponseParser/Field.php
+11
-8
library/Solarium/QueryType/Analysis/Result/Document.php
library/Solarium/QueryType/Analysis/Result/Document.php
+2
-1
library/Solarium/QueryType/Select/Query/Component/Facet/MultiQuery.php
...ium/QueryType/Select/Query/Component/Facet/MultiQuery.php
+1
-1
library/Solarium/QueryType/Select/Query/Component/FacetSet.php
...ry/Solarium/QueryType/Select/Query/Component/FacetSet.php
+2
-1
library/Solarium/QueryType/Select/Query/Query.php
library/Solarium/QueryType/Select/Query/Query.php
+3
-2
library/Solarium/QueryType/Select/ResponseParser/Component/Spellcheck.php
.../QueryType/Select/ResponseParser/Component/Spellcheck.php
+7
-2
library/Solarium/QueryType/Select/Result/Highlighting/Highlighting.php
...ium/QueryType/Select/Result/Highlighting/Highlighting.php
+2
-1
library/Solarium/QueryType/Select/Result/MoreLikeThis/MoreLikeThis.php
...ium/QueryType/Select/Result/MoreLikeThis/MoreLikeThis.php
+2
-1
library/Solarium/QueryType/Select/Result/MoreLikeThis/Result.php
.../Solarium/QueryType/Select/Result/MoreLikeThis/Result.php
+2
-1
library/Solarium/QueryType/Select/Result/Result.php
library/Solarium/QueryType/Select/Result/Result.php
+2
-1
library/Solarium/QueryType/Select/Result/Spellcheck/Result.php
...ry/Solarium/QueryType/Select/Result/Spellcheck/Result.php
+4
-2
library/Solarium/QueryType/Select/Result/Stats/Stats.php
library/Solarium/QueryType/Select/Result/Stats/Stats.php
+2
-1
library/Solarium/QueryType/Update/Query/Command/Add.php
library/Solarium/QueryType/Update/Query/Command/Add.php
+1
-1
library/Solarium/QueryType/Update/Query/Query.php
library/Solarium/QueryType/Update/Query/Query.php
+16
-10
tests/Solarium/Tests/QueryType/Select/ResponseParser/Component/SpellcheckTest.php
...ryType/Select/ResponseParser/Component/SpellcheckTest.php
+6
-4
No files found.
library/Solarium/Core/Client/Adapter/Curl.php
View file @
981af911
...
@@ -88,7 +88,7 @@ class Curl extends Configurable implements AdapterInterface
...
@@ -88,7 +88,7 @@ class Curl extends Configurable implements AdapterInterface
*
*
* @param Request $request
* @param Request $request
* @param Endpoint $endpoint
* @param Endpoint $endpoint
* @return
array
* @return
Response
*/
*/
protected
function
getData
(
$request
,
$endpoint
)
protected
function
getData
(
$request
,
$endpoint
)
{
{
...
...
library/Solarium/Core/Client/Client.php
View file @
981af911
...
@@ -347,7 +347,7 @@ class Client extends Configurable
...
@@ -347,7 +347,7 @@ class Client extends Configurable
/**
/**
* Get all endpoints
* Get all endpoints
*
*
* @return
array
* @return
Endpoint[]
*/
*/
public
function
getEndpoints
()
public
function
getEndpoints
()
{
{
...
@@ -626,7 +626,7 @@ class Client extends Configurable
...
@@ -626,7 +626,7 @@ class Client extends Configurable
/**
/**
* Get all registered plugins
* Get all registered plugins
*
*
* @return
array
* @return
PluginInterface[]
*/
*/
public
function
getPlugins
()
public
function
getPlugins
()
{
{
...
...
library/Solarium/Core/Query/ResponseParser.php
View file @
981af911
...
@@ -54,9 +54,24 @@ abstract class ResponseParser
...
@@ -54,9 +54,24 @@ abstract class ResponseParser
*/
*/
public
function
convertToKeyValueArray
(
$data
)
public
function
convertToKeyValueArray
(
$data
)
{
{
// key counter to convert values to arrays when keys are re-used
$keys
=
array
();
$result
=
array
();
$result
=
array
();
for
(
$i
=
0
;
$i
<
count
(
$data
);
$i
+=
2
)
{
for
(
$i
=
0
;
$i
<
count
(
$data
);
$i
+=
2
)
{
$result
[
$data
[
$i
]]
=
$data
[
$i
+
1
];
$key
=
$data
[
$i
];
$value
=
$data
[
$i
+
1
];
if
(
array_key_exists
(
$key
,
$keys
))
{
if
(
$keys
[
$key
]
==
1
)
{
$result
[
$key
]
=
array
(
$result
[
$key
]);
}
$result
[
$key
][]
=
$value
;
$keys
[
$key
]
++
;
}
else
{
$keys
[
$key
]
=
1
;
$result
[
$key
]
=
$value
;
}
}
}
return
$result
;
return
$result
;
...
...
library/Solarium/Plugin/BufferedAdd/BufferedAdd.php
View file @
981af911
...
@@ -41,6 +41,7 @@ use Solarium\Client;
...
@@ -41,6 +41,7 @@ use Solarium\Client;
use
Solarium\Core\Plugin\Plugin
;
use
Solarium\Core\Plugin\Plugin
;
use
Solarium\QueryType\Update\Result
as
UpdateResult
;
use
Solarium\QueryType\Update\Result
as
UpdateResult
;
use
Solarium\QueryType\Update\Query\Query
as
UpdateQuery
;
use
Solarium\QueryType\Update\Query\Query
as
UpdateQuery
;
use
Solarium\QueryType\Select\Result\DocumentInterface
;
use
Solarium\QueryType\Select\Result\Document
as
ReadOnlyDocument
;
use
Solarium\QueryType\Select\Result\Document
as
ReadOnlyDocument
;
use
Solarium\Plugin\BufferedAdd\Event\Events
;
use
Solarium\Plugin\BufferedAdd\Event\Events
;
use
Solarium\Plugin\BufferedAdd\Event\PreFlush
as
PreFlushEvent
;
use
Solarium\Plugin\BufferedAdd\Event\PreFlush
as
PreFlushEvent
;
...
@@ -76,7 +77,7 @@ class BufferedAdd extends Plugin
...
@@ -76,7 +77,7 @@ class BufferedAdd extends Plugin
/**
/**
* Buffered documents
* Buffered documents
*
*
* @var
array
* @var
DocumentInterface[]
*/
*/
protected
$buffer
=
array
();
protected
$buffer
=
array
();
...
@@ -132,7 +133,7 @@ class BufferedAdd extends Plugin
...
@@ -132,7 +133,7 @@ class BufferedAdd extends Plugin
/**
/**
* Add a document
* Add a document
*
*
* @param
ReadOnlyDocument
$document
* @param
DocumentInterface
$document
* @return self Provides fluent interface
* @return self Provides fluent interface
*/
*/
public
function
addDocument
(
$document
)
public
function
addDocument
(
$document
)
...
@@ -165,7 +166,7 @@ class BufferedAdd extends Plugin
...
@@ -165,7 +166,7 @@ class BufferedAdd extends Plugin
*
*
* Any previously flushed documents will not be included!
* Any previously flushed documents will not be included!
*
*
* @return
array
* @return
DocumentInterface[]
*/
*/
public
function
getDocuments
()
public
function
getDocuments
()
{
{
...
...
library/Solarium/Plugin/BufferedAdd/Event/PostCommit.php
View file @
981af911
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
namespace
Solarium\Plugin\BufferedAdd\Event
;
namespace
Solarium\Plugin\BufferedAdd\Event
;
use
Symfony\Component\EventDispatcher\Event
;
use
Symfony\Component\EventDispatcher\Event
;
use
Solarium\QueryType\Update\Result
;
use
Solarium\QueryType\Update\Result
;
use
Solarium\QueryType\Select\Result\DocumentInterface
;
/**
/**
* PostCommit event, see Events for details
* PostCommit event, see Events for details
...
@@ -64,7 +65,7 @@ class PostCommit extends Event
...
@@ -64,7 +65,7 @@ class PostCommit extends Event
/**
/**
* Get the result for this event
* Get the result for this event
*
*
* @return
array
* @return
DocumentInterface[]
*/
*/
public
function
getResult
()
public
function
getResult
()
{
{
...
...
library/Solarium/Plugin/BufferedAdd/Event/PostFlush.php
View file @
981af911
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
namespace
Solarium\Plugin\BufferedAdd\Event
;
namespace
Solarium\Plugin\BufferedAdd\Event
;
use
Symfony\Component\EventDispatcher\Event
;
use
Symfony\Component\EventDispatcher\Event
;
use
Solarium\QueryType\Update\Result
;
use
Solarium\QueryType\Update\Result
;
use
Solarium\QueryType\Select\Result\DocumentInterface
;
/**
/**
* PostFlush event, see Events for details
* PostFlush event, see Events for details
...
@@ -64,7 +65,7 @@ class PostFlush extends Event
...
@@ -64,7 +65,7 @@ class PostFlush extends Event
/**
/**
* Get the result for this event
* Get the result for this event
*
*
* @return
array
* @return
DocumentInterface[]
*/
*/
public
function
getResult
()
public
function
getResult
()
{
{
...
...
library/Solarium/Plugin/BufferedAdd/Event/PreCommit.php
View file @
981af911
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
*/
*/
namespace
Solarium\Plugin\BufferedAdd\Event
;
namespace
Solarium\Plugin\BufferedAdd\Event
;
use
Symfony\Component\EventDispatcher\Event
;
use
Symfony\Component\EventDispatcher\Event
;
use
Solarium\QueryType\Select\Result\DocumentInterface
;
/**
/**
* PreCommit event, see Events for details
* PreCommit event, see Events for details
...
@@ -87,7 +88,7 @@ class PreCommit extends Event
...
@@ -87,7 +88,7 @@ class PreCommit extends Event
/**
/**
* Get the buffer for this event
* Get the buffer for this event
*
*
* @return
array
* @return
DocumentInterface[]
*/
*/
public
function
getBuffer
()
public
function
getBuffer
()
{
{
...
...
library/Solarium/Plugin/BufferedAdd/Event/PreFlush.php
View file @
981af911
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
*/
*/
namespace
Solarium\Plugin\BufferedAdd\Event
;
namespace
Solarium\Plugin\BufferedAdd\Event
;
use
Symfony\Component\EventDispatcher\Event
;
use
Symfony\Component\EventDispatcher\Event
;
use
Solarium\QueryType\Select\Result\DocumentInterface
;
/**
/**
* PreFlush event, see Events for details
* PreFlush event, see Events for details
...
@@ -77,7 +78,7 @@ class PreFlush extends Event
...
@@ -77,7 +78,7 @@ class PreFlush extends Event
/**
/**
* Get the buffer for this event
* Get the buffer for this event
*
*
* @return
array
* @return
DocumentInterface[]
*/
*/
public
function
getBuffer
()
public
function
getBuffer
()
{
{
...
...
library/Solarium/Plugin/CustomizeRequest/CustomizeRequest.php
View file @
981af911
...
@@ -194,7 +194,7 @@ class CustomizeRequest extends Plugin
...
@@ -194,7 +194,7 @@ class CustomizeRequest extends Plugin
/**
/**
* Get all Customizations
* Get all Customizations
*
*
* @return
array
* @return
Customization[]
*/
*/
public
function
getCustomizations
()
public
function
getCustomizations
()
{
{
...
...
library/Solarium/Plugin/Loadbalancer/Loadbalancer.php
View file @
981af911
...
@@ -264,7 +264,7 @@ class Loadbalancer extends Plugin
...
@@ -264,7 +264,7 @@ class Loadbalancer extends Plugin
/**
/**
* Get the endpoints in the loadbalancing pool
* Get the endpoints in the loadbalancing pool
*
*
* @return
array
* @return
Endpoint[]
*/
*/
public
function
getEndpoints
()
public
function
getEndpoints
()
{
{
...
...
library/Solarium/Plugin/ParallelExecution/ParallelExecution.php
View file @
981af911
...
@@ -42,6 +42,7 @@ use Solarium\Core\Client\Endpoint;
...
@@ -42,6 +42,7 @@ use Solarium\Core\Client\Endpoint;
use
Solarium\Exception\HttpException
;
use
Solarium\Exception\HttpException
;
use
Solarium\Core\Client\Client
;
use
Solarium\Core\Client\Client
;
use
Solarium\Core\Query\Query
;
use
Solarium\Core\Query\Query
;
use
Solarium\Core\Query\Result
;
use
Solarium\Plugin\ParallelExecution\Event\Events
;
use
Solarium\Plugin\ParallelExecution\Event\Events
;
use
Solarium\Plugin\ParallelExecution\Event\ExecuteStart
as
ExecuteStartEvent
;
use
Solarium\Plugin\ParallelExecution\Event\ExecuteStart
as
ExecuteStartEvent
;
use
Solarium\Plugin\ParallelExecution\Event\ExecuteEnd
as
ExecuteEndEvent
;
use
Solarium\Plugin\ParallelExecution\Event\ExecuteEnd
as
ExecuteEndEvent
;
...
@@ -113,7 +114,7 @@ class ParallelExecution extends Plugin
...
@@ -113,7 +114,7 @@ class ParallelExecution extends Plugin
/**
/**
* Get queries (and coupled client instances)
* Get queries (and coupled client instances)
*
*
* @return
array
* @return
Query[]
*/
*/
public
function
getQueries
()
public
function
getQueries
()
{
{
...
@@ -137,7 +138,7 @@ class ParallelExecution extends Plugin
...
@@ -137,7 +138,7 @@ class ParallelExecution extends Plugin
/**
/**
* Execute queries parallel
* Execute queries parallel
*
*
* @return
array
* @return
Result[]
*/
*/
public
function
execute
()
public
function
execute
()
{
{
...
...
library/Solarium/QueryType/Analysis/Query/Document.php
View file @
981af911
...
@@ -40,6 +40,7 @@ namespace Solarium\QueryType\Analysis\Query;
...
@@ -40,6 +40,7 @@ namespace Solarium\QueryType\Analysis\Query;
use
Solarium\Core\Client\Client
;
use
Solarium\Core\Client\Client
;
use
Solarium\QueryType\Analysis\ResponseParser\Document
as
ResponseParser
;
use
Solarium\QueryType\Analysis\ResponseParser\Document
as
ResponseParser
;
use
Solarium\QueryType\Analysis\RequestBuilder\Document
as
RequestBuilder
;
use
Solarium\QueryType\Analysis\RequestBuilder\Document
as
RequestBuilder
;
use
Solarium\QueryType\Select\Result\DocumentInterface
;
/**
/**
* Analysis document query
* Analysis document query
...
@@ -111,7 +112,7 @@ class Document extends Query
...
@@ -111,7 +112,7 @@ class Document extends Query
/**
/**
* Add multiple documents
* Add multiple documents
*
*
* @param
array
$documents
* @param
DocumentInterface[]
$documents
* @return self fluent interface
* @return self fluent interface
*/
*/
public
function
addDocuments
(
$documents
)
public
function
addDocuments
(
$documents
)
...
@@ -124,7 +125,7 @@ class Document extends Query
...
@@ -124,7 +125,7 @@ class Document extends Query
/**
/**
* Get all documents
* Get all documents
*
*
* @return
array
* @return
DocumentInterface[]
*/
*/
public
function
getDocuments
()
public
function
getDocuments
()
{
{
...
...
library/Solarium/QueryType/Analysis/ResponseParser/Document.php
View file @
981af911
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
*/
*/
namespace
Solarium\QueryType\Analysis\ResponseParser
;
namespace
Solarium\QueryType\Analysis\ResponseParser
;
use
Solarium\QueryType\Analysis\Result
as
AnalysisResult
;
use
Solarium\QueryType\Analysis\Result
as
AnalysisResult
;
use
Solarium\QueryType\Analysis\Result\ResultList
;
/**
/**
* Parse document analysis response data
* Parse document analysis response data
...
@@ -50,14 +51,14 @@ class Document extends Field
...
@@ -50,14 +51,14 @@ class Document extends Field
*
*
* @param Result $result
* @param Result $result
* @param array $data
* @param array $data
* @return
array
* @return
ResultList[]
*/
*/
protected
function
parseAnalysis
(
$result
,
$data
)
protected
function
parseAnalysis
(
$result
,
$data
)
{
{
$documents
=
array
();
$documents
=
array
();
foreach
(
$data
as
$documentKey
=>
$documentData
)
{
foreach
(
$data
as
$documentKey
=>
$documentData
)
{
$fields
=
$this
->
parseTypes
(
$result
,
$documentData
);
$fields
=
$this
->
parseTypes
(
$result
,
$documentData
);
$documents
[]
=
new
AnalysisResult\
ResultList
(
$documentKey
,
$fields
);
$documents
[]
=
new
ResultList
(
$documentKey
,
$fields
);
}
}
return
$documents
;
return
$documents
;
...
...
library/Solarium/QueryType/Analysis/ResponseParser/Field.php
View file @
981af911
...
@@ -39,6 +39,9 @@
...
@@ -39,6 +39,9 @@
namespace
Solarium\QueryType\Analysis\ResponseParser
;
namespace
Solarium\QueryType\Analysis\ResponseParser
;
use
Solarium\Core\Query\Result\Result
;
use
Solarium\Core\Query\Result\Result
;
use
Solarium\QueryType\Analysis\Result
as
AnalysisResult
;
use
Solarium\QueryType\Analysis\Result
as
AnalysisResult
;
use
Solarium\QueryType\Analysis\Result\ResultList
;
use
Solarium\QueryType\Analysis\Result\Item
;
use
Solarium\QueryType\Analysis\Result\Types
;
use
Solarium\Core\Query\ResponseParser
as
ResponseParserAbstract
;
use
Solarium\Core\Query\ResponseParser
as
ResponseParserAbstract
;
use
Solarium\Core\Query\ResponseParserInterface
as
ResponseParserInterface
;
use
Solarium\Core\Query\ResponseParserInterface
as
ResponseParserInterface
;
...
@@ -72,7 +75,7 @@ class Field extends ResponseParserAbstract implements ResponseParserInterface
...
@@ -72,7 +75,7 @@ class Field extends ResponseParserAbstract implements ResponseParserInterface
*
*
* @param Result $result
* @param Result $result
* @param array $data
* @param array $data
* @return
array
* @return
Types[]
*/
*/
protected
function
parseAnalysis
(
$result
,
$data
)
protected
function
parseAnalysis
(
$result
,
$data
)
{
{
...
@@ -90,7 +93,7 @@ class Field extends ResponseParserAbstract implements ResponseParserInterface
...
@@ -90,7 +93,7 @@ class Field extends ResponseParserAbstract implements ResponseParserInterface
*
*
* @param Result $result
* @param Result $result
* @param array $typeData
* @param array $typeData
* @return
array
* @return
Types[]
*/
*/
protected
function
parseTypes
(
$result
,
$typeData
)
protected
function
parseTypes
(
$result
,
$typeData
)
{
{
...
@@ -116,7 +119,7 @@ class Field extends ResponseParserAbstract implements ResponseParserInterface
...
@@ -116,7 +119,7 @@ class Field extends ResponseParserAbstract implements ResponseParserInterface
foreach
(
$typeData
as
$class
=>
$analysis
)
{
foreach
(
$typeData
as
$class
=>
$analysis
)
{
if
(
is_string
(
$analysis
))
{
if
(
is_string
(
$analysis
))
{
$item
=
new
AnalysisResult\
Item
(
$item
=
new
Item
(
array
(
array
(
'text'
=>
$analysis
,
'text'
=>
$analysis
,
'start'
=>
null
,
'start'
=>
null
,
...
@@ -127,23 +130,23 @@ class Field extends ResponseParserAbstract implements ResponseParserInterface
...
@@ -127,23 +130,23 @@ class Field extends ResponseParserAbstract implements ResponseParserInterface
)
)
);
);
$classes
[]
=
new
AnalysisResult\
ResultList
(
$class
,
array
(
$item
));
$classes
[]
=
new
ResultList
(
$class
,
array
(
$item
));
}
else
{
}
else
{
$items
=
array
();
$items
=
array
();
foreach
(
$analysis
as
$itemData
)
{
foreach
(
$analysis
as
$itemData
)
{
$items
[]
=
new
AnalysisResult\
Item
(
$itemData
);
$items
[]
=
new
Item
(
$itemData
);
}
}
$classes
[]
=
new
AnalysisResult\
ResultList
(
$class
,
$items
);
$classes
[]
=
new
ResultList
(
$class
,
$items
);
}
}
}
}
$types
[]
=
new
AnalysisResult\
ResultList
(
$typeKey
,
$classes
);
$types
[]
=
new
ResultList
(
$typeKey
,
$classes
);
}
}
$results
[]
=
new
AnalysisResult\
Types
(
$fieldKey
,
$types
);
$results
[]
=
new
Types
(
$fieldKey
,
$types
);
}
}
return
$results
;
return
$results
;
...
...
library/Solarium/QueryType/Analysis/Result/Document.php
View file @
981af911
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
*/
*/
namespace
Solarium\QueryType\Analysis\Result
;
namespace
Solarium\QueryType\Analysis\Result
;
use
Solarium\Core\Query\Result\QueryType
as
BaseResult
;
use
Solarium\Core\Query\Result\QueryType
as
BaseResult
;
use
Solarium\QueryType\Analysis\Result\ResultList
;
/**
/**
* Analysis document query result
* Analysis document query result
...
@@ -101,7 +102,7 @@ class Document extends BaseResult implements \IteratorAggregate, \Countable
...
@@ -101,7 +102,7 @@ class Document extends BaseResult implements \IteratorAggregate, \Countable
/**
/**
* Get all documents
* Get all documents
*
*
* @return
array
* @return
ResultList[]
*/
*/
public
function
getDocuments
()
public
function
getDocuments
()
{
{
...
...
library/Solarium/QueryType/Select/Query/Component/Facet/MultiQuery.php
View file @
981af911
...
@@ -187,7 +187,7 @@ class MultiQuery extends Facet
...
@@ -187,7 +187,7 @@ class MultiQuery extends Facet
/**
/**
* Get all facetqueries
* Get all facetqueries
*
*
* @return
array
* @return
Query[]
*/
*/
public
function
getQueries
()
public
function
getQueries
()
{
{
...
...
library/Solarium/QueryType/Select/Query/Component/FacetSet.php
View file @
981af911
...
@@ -42,6 +42,7 @@ use Solarium\QueryType\Select\RequestBuilder\Component\FacetSet as RequestBuilde
...
@@ -42,6 +42,7 @@ use Solarium\QueryType\Select\RequestBuilder\Component\FacetSet as RequestBuilde
use
Solarium\QueryType\Select\ResponseParser\Component\FacetSet
as
ResponseParser
;
use
Solarium\QueryType\Select\ResponseParser\Component\FacetSet
as
ResponseParser
;
use
Solarium\Exception\InvalidArgumentException
;
use
Solarium\Exception\InvalidArgumentException
;
use
Solarium\Exception\OutOfBoundsException
;
use
Solarium\Exception\OutOfBoundsException
;
use
Solarium\QueryType\Select\Query\Component\Facet\Facet
;
/**
/**
* MoreLikeThis component
* MoreLikeThis component
...
@@ -344,7 +345,7 @@ class FacetSet extends Component
...
@@ -344,7 +345,7 @@ class FacetSet extends Component
/**
/**
* Get all facets
* Get all facets
*
*
* @return
array
* @return
Facet[]
*/
*/
public
function
getFacets
()
public
function
getFacets
()
{
{
...
...
library/Solarium/QueryType/Select/Query/Query.php
View file @
981af911
...
@@ -43,6 +43,7 @@ use Solarium\QueryType\Select\RequestBuilder\RequestBuilder;
...
@@ -43,6 +43,7 @@ use Solarium\QueryType\Select\RequestBuilder\RequestBuilder;
use
Solarium\QueryType\Select\ResponseParser\ResponseParser
;
use
Solarium\QueryType\Select\ResponseParser\ResponseParser
;
use
Solarium\Exception\InvalidArgumentException
;
use
Solarium\Exception\InvalidArgumentException
;
use
Solarium\Exception\OutOfBoundsException
;
use
Solarium\Exception\OutOfBoundsException
;
use
Solarium\QueryType\Select\Query\Component\Component
;
/**
/**
* Select Query
* Select Query
...
@@ -706,7 +707,7 @@ class Query extends BaseQuery
...
@@ -706,7 +707,7 @@ class Query extends BaseQuery
/**
/**
* Get all filterqueries
* Get all filterqueries
*
*
* @return
array
* @return
FilterQuery[]
*/
*/
public
function
getFilterQueries
()
public
function
getFilterQueries
()
{
{
...
@@ -786,7 +787,7 @@ class Query extends BaseQuery
...
@@ -786,7 +787,7 @@ class Query extends BaseQuery
/**
/**
* Get all registered components
* Get all registered components
*
*
* @return
array
* @return
Component[]
*/
*/
public
function
getComponents
()
public
function
getComponents
()
{
{
...
...
library/Solarium/QueryType/Select/ResponseParser/Component/Spellcheck.php
View file @
981af911
...
@@ -74,14 +74,19 @@ class Spellcheck extends ResponseParserAbstract
...
@@ -74,14 +74,19 @@ class Spellcheck extends ResponseParserAbstract
$correctlySpelled
=
null
;
$correctlySpelled
=
null
;
$collations
=
array
();
$collations
=
array
();
foreach
(
$spellcheckResults
as
$key
=>
$value
)
{
foreach
(
$spellcheckResults
as
$key
=>
$value
)
{
switch
(
$key
)
{
switch
(
$key
)
{
case
'correctlySpelled'
:
case
'correctlySpelled'
:
$correctlySpelled
=
$value
;
$correctlySpelled
=
$value
;
break
;
break
;
case
'collation'
:
case
'collation'
:
$collations
[]
=
$this
->
parseCollation
(
$query
,
$value
);
if
(
!
array_key_exists
(
'collation'
,
$value
)){
foreach
(
$value
as
$collationValue
)
{
$collations
[]
=
$this
->
parseCollation
(
$query
,
$collationValue
);
}
}
else
{
$collations
[]
=
$this
->
parseCollation
(
$query
,
$value
);
}
break
;
break
;
default
:
default
:
$suggestions
[]
=
$this
->
parseSuggestion
(
$key
,
$value
);
$suggestions
[]
=
$this
->
parseSuggestion
(
$key
,
$value
);
...
...
library/Solarium/QueryType/Select/Result/Highlighting/Highlighting.php
View file @
981af911
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
* @namespace
* @namespace
*/
*/
namespace
Solarium\QueryType\Select\Result\Highlighting
;
namespace
Solarium\QueryType\Select\Result\Highlighting
;
use
Solarium\QueryType\Select\Result\Highlighting\Result
;
/**
/**
* Select component highlighting result
* Select component highlighting result
...
@@ -80,7 +81,7 @@ class Highlighting implements \IteratorAggregate, \Countable
...
@@ -80,7 +81,7 @@ class Highlighting implements \IteratorAggregate, \Countable
/**
/**
* Get all results
* Get all results
*
*
* @return
array
* @return
Result[]
*/
*/
public
function
getResults
()
public
function
getResults
()
{
{
...
...
library/Solarium/QueryType/Select/Result/MoreLikeThis/MoreLikeThis.php
View file @
981af911
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
* @namespace
* @namespace
*/
*/
namespace
Solarium\QueryType\Select\Result\MoreLikeThis
;
namespace
Solarium\QueryType\Select\Result\MoreLikeThis
;
use
Solarium\QueryType\Select\Result\MoreLikeThis\Result
;
/**
/**
* Select component morelikethis result
* Select component morelikethis result
...
@@ -80,7 +81,7 @@ class MoreLikeThis implements \IteratorAggregate, \Countable
...
@@ -80,7 +81,7 @@ class MoreLikeThis implements \IteratorAggregate, \Countable
/**
/**
* Get all results
* Get all results
*
*
* @return
array
* @return
Result[]
*/
*/
public
function
getResults
()
public
function
getResults
()
{
{
...
...
library/Solarium/QueryType/Select/Result/MoreLikeThis/Result.php
View file @
981af911
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
* @namespace
* @namespace
*/
*/
namespace
Solarium\QueryType\Select\Result\MoreLikeThis
;
namespace
Solarium\QueryType\Select\Result\MoreLikeThis
;
use
Solarium\QueryType\Select\Result\DocumentInterface
;
/**
/**
* Select component morelikethis result item
* Select component morelikethis result item
...
@@ -108,7 +109,7 @@ class Result implements \IteratorAggregate, \Countable
...
@@ -108,7 +109,7 @@ class Result implements \IteratorAggregate, \Countable
/**
/**
* Get all documents
* Get all documents
*
*
* @return
array
* @return
DocumentInterface[]
*/
*/
public
function
getDocuments
()
public
function
getDocuments
()
{
{
...
...
library/Solarium/QueryType/Select/Result/Result.php
View file @
981af911
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
namespace
Solarium\QueryType\Select\Result
;
namespace
Solarium\QueryType\Select\Result
;
use
Solarium\QueryType\Select\Query\Query
as
SelectQuery
;
use
Solarium\QueryType\Select\Query\Query
as
SelectQuery
;
use
Solarium\Core\Query\Result\QueryType
as
BaseResult
;
use
Solarium\Core\Query\Result\QueryType
as
BaseResult
;
use
Solarium\QueryType\Select\Result\DocumentInterface
;
/**
/**
* Select query result
* Select query result
...
@@ -148,7 +149,7 @@ class Result extends BaseResult implements \IteratorAggregate, \Countable
...
@@ -148,7 +149,7 @@ class Result extends BaseResult implements \IteratorAggregate, \Countable
/**
/**
* Get all documents
* Get all documents
*
*
* @return
array
* @return
DocumentInterface[]
*/
*/
public
function
getDocuments
()
public
function
getDocuments
()
{
{
...
...
library/Solarium/QueryType/Select/Result/Spellcheck/Result.php
View file @
981af911
...
@@ -37,6 +37,8 @@
...
@@ -37,6 +37,8 @@
* @namespace
* @namespace
*/
*/
namespace
Solarium\QueryType\Select\Result\Spellcheck
;
namespace
Solarium\QueryType\Select\Result\Spellcheck
;
use
Solarium\QueryType\Select\Result\Spellcheck\Collation
;
use
Solarium\QueryType\Select\Result\Spellcheck\Suggestion
;
/**
/**
* Select component spellcheck result
* Select component spellcheck result
...
@@ -104,7 +106,7 @@ class Result implements \IteratorAggregate, \Countable
...
@@ -104,7 +106,7 @@ class Result implements \IteratorAggregate, \Countable
/**
/**
* Get all collations
* Get all collations
*
*
* @return
array
* @return
Collation[]
*/
*/
public
function
getCollations
()
public
function
getCollations
()
{
{
...
@@ -141,7 +143,7 @@ class Result implements \IteratorAggregate, \Countable
...
@@ -141,7 +143,7 @@ class Result implements \IteratorAggregate, \Countable
/**
/**
* Get all suggestions
* Get all suggestions
*
*
* @return
array
* @return
Suggestion[]
*/
*/
public
function
getSuggestions
()
public
function
getSuggestions
()
{
{
...
...
library/Solarium/QueryType/Select/Result/Stats/Stats.php
View file @
981af911
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
* @namespace
* @namespace
*/
*/
namespace
Solarium\QueryType\Select\Result\Stats
;
namespace
Solarium\QueryType\Select\Result\Stats
;
use
Solarium\QueryType\Select\Result\Stats\Result
;
/**
/**
* Select component stats result
* Select component stats result
...
@@ -80,7 +81,7 @@ class Stats implements \IteratorAggregate, \Countable
...
@@ -80,7 +81,7 @@ class Stats implements \IteratorAggregate, \Countable
/**
/**
* Get all results
* Get all results
*
*
* @return
array
* @return
Result[]
*/
*/
public
function
getResults
()
public
function
getResults
()
{
{
...
...
library/Solarium/QueryType/Update/Query/Command/Add.php
View file @
981af911
...
@@ -115,7 +115,7 @@ class Add extends Command
...
@@ -115,7 +115,7 @@ class Add extends Command
/**
/**
* Get all documents
* Get all documents
*
*
* @return
array
* @return
DocumentInterface[]
*/
*/
public
function
getDocuments
()
public
function
getDocuments
()
{
{
...
...
library/Solarium/QueryType/Update/Query/Query.php
View file @
981af911
...
@@ -43,6 +43,12 @@ use Solarium\QueryType\Update\RequestBuilder;
...
@@ -43,6 +43,12 @@ use Solarium\QueryType\Update\RequestBuilder;
use
Solarium\QueryType\Update\ResponseParser
;
use
Solarium\QueryType\Update\ResponseParser
;
use
Solarium\Exception\RuntimeException
;
use
Solarium\Exception\RuntimeException
;
use
Solarium\Exception\InvalidArgumentException
;
use
Solarium\Exception\InvalidArgumentException
;
use
Solarium\QueryType\Update\Query\Command\Command
;
use
Solarium\QueryType\Update\Query\Command\Add
as
AddCommand
;
use
Solarium\QueryType\Update\Query\Command\Commit
as
CommitCommand
;
use
Solarium\QueryType\Update\Query\Command\Delete
as
DeleteCommand
;
use
Solarium\QueryType\Update\Query\Command\Optimize
as
OptimizeCommand
;
use
Solarium\QueryType\Update\Query\Command\Rollback
as
RollbackCommand
;
/**
/**
* Update query
* Update query
...
@@ -178,7 +184,7 @@ class Query extends BaseQuery
...
@@ -178,7 +184,7 @@ class Query extends BaseQuery
* @throws InvalidArgumentException
* @throws InvalidArgumentException
* @param string $type
* @param string $type
* @param mixed $options
* @param mixed $options
* @return Command
\Command
* @return Command
*/
*/
public
function
createCommand
(
$type
,
$options
=
null
)
public
function
createCommand
(
$type
,
$options
=
null
)
{
{
...
@@ -196,7 +202,7 @@ class Query extends BaseQuery
...
@@ -196,7 +202,7 @@ class Query extends BaseQuery
/**
/**
* Get all commands for this update query
* Get all commands for this update query
*
*
* @return
array
* @return
Command[]
*/
*/
public
function
getCommands
()
public
function
getCommands
()
{
{
...
@@ -260,7 +266,7 @@ class Query extends BaseQuery
...
@@ -260,7 +266,7 @@ class Query extends BaseQuery
*/
*/
public
function
addRollback
()
public
function
addRollback
()
{
{
return
$this
->
add
(
null
,
new
Command\Rollback
);
return
$this
->
add
(
null
,
new
RollbackCommand
);
}
}
/**
/**
...
@@ -274,7 +280,7 @@ class Query extends BaseQuery
...
@@ -274,7 +280,7 @@ class Query extends BaseQuery
*/
*/
public
function
addDeleteQuery
(
$query
)
public
function
addDeleteQuery
(
$query
)
{
{
$delete
=
new
Command\Delete
;
$delete
=
new
DeleteCommand
;
$delete
->
addQuery
(
$query
);
$delete
->
addQuery
(
$query
);
return
$this
->
add
(
null
,
$delete
);
return
$this
->
add
(
null
,
$delete
);
...
@@ -291,7 +297,7 @@ class Query extends BaseQuery
...
@@ -291,7 +297,7 @@ class Query extends BaseQuery
*/
*/
public
function
addDeleteQueries
(
$queries
)
public
function
addDeleteQueries
(
$queries
)
{
{
$delete
=
new
Command\Delete
;
$delete
=
new
DeleteCommand
;
$delete
->
addQueries
(
$queries
);
$delete
->
addQueries
(
$queries
);
return
$this
->
add
(
null
,
$delete
);
return
$this
->
add
(
null
,
$delete
);
...
@@ -308,7 +314,7 @@ class Query extends BaseQuery
...
@@ -308,7 +314,7 @@ class Query extends BaseQuery
*/
*/
public
function
addDeleteById
(
$id
)
public
function
addDeleteById
(
$id
)
{
{
$delete
=
new
Command\Delete
;
$delete
=
new
DeleteCommand
;
$delete
->
addId
(
$id
);
$delete
->
addId
(
$id
);
return
$this
->
add
(
null
,
$delete
);
return
$this
->
add
(
null
,
$delete
);
...
@@ -325,7 +331,7 @@ class Query extends BaseQuery
...
@@ -325,7 +331,7 @@ class Query extends BaseQuery
*/
*/
public
function
addDeleteByIds
(
$ids
)
public
function
addDeleteByIds
(
$ids
)
{
{
$delete
=
new
Command\Delete
;
$delete
=
new
DeleteCommand
;
$delete
->
addIds
(
$ids
);
$delete
->
addIds
(
$ids
);
return
$this
->
add
(
null
,
$delete
);
return
$this
->
add
(
null
,
$delete
);
...
@@ -362,7 +368,7 @@ class Query extends BaseQuery
...
@@ -362,7 +368,7 @@ class Query extends BaseQuery
public
function
addDocuments
(
$documents
,
$overwrite
=
null
,
public
function
addDocuments
(
$documents
,
$overwrite
=
null
,
$commitWithin
=
null
)
$commitWithin
=
null
)
{
{
$add
=
new
Command\Ad
d
;
$add
=
new
AddComman
d
;
if
(
null
!==
$overwrite
)
{
if
(
null
!==
$overwrite
)
{
$add
->
setOverwrite
(
$overwrite
);
$add
->
setOverwrite
(
$overwrite
);
...
@@ -391,7 +397,7 @@ class Query extends BaseQuery
...
@@ -391,7 +397,7 @@ class Query extends BaseQuery
public
function
addCommit
(
$softCommit
=
null
,
$waitSearcher
=
null
,
public
function
addCommit
(
$softCommit
=
null
,
$waitSearcher
=
null
,
$expungeDeletes
=
null
)
$expungeDeletes
=
null
)
{
{
$commit
=
new
Comm
and\Commit
();
$commit
=
new
Comm
itCommand
();
if
(
null
!==
$softCommit
)
{
if
(
null
!==
$softCommit
)
{
$commit
->
setSoftCommit
(
$softCommit
);
$commit
->
setSoftCommit
(
$softCommit
);
...
@@ -422,7 +428,7 @@ class Query extends BaseQuery
...
@@ -422,7 +428,7 @@ class Query extends BaseQuery
public
function
addOptimize
(
$softCommit
=
null
,
$waitSearcher
=
null
,
public
function
addOptimize
(
$softCommit
=
null
,
$waitSearcher
=
null
,
$maxSegments
=
null
)
$maxSegments
=
null
)
{
{
$optimize
=
new
Command\Optimize
();
$optimize
=
new
OptimizeCommand
();
if
(
null
!==
$softCommit
)
{
if
(
null
!==
$softCommit
)
{
$optimize
->
setSoftCommit
(
$softCommit
);
$optimize
->
setSoftCommit
(
$softCommit
);
...
...
tests/Solarium/Tests/QueryType/Select/ResponseParser/Component/SpellcheckTest.php
View file @
981af911
...
@@ -31,14 +31,16 @@
...
@@ -31,14 +31,16 @@
namespace
Solarium\Tests\QueryType\Select\ResponseParser\Component
;
namespace
Solarium\Tests\QueryType\Select\ResponseParser\Component
;
use
Solarium\QueryType\Select\ResponseParser\Component\Spellcheck
as
Parser
;
use
Solarium\QueryType\Select\ResponseParser\Component\Spellcheck
as
Parser
;
use
Solarium\QueryType\Select\Query\Query
;
class
SpellcheckTest
extends
\PHPUnit_Framework_TestCase
class
SpellcheckTest
extends
\PHPUnit_Framework_TestCase
{
{
protected
$parser
;
protected
$parser
,
$query
;
public
function
setUp
()
public
function
setUp
()
{
{
$this
->
query
=
new
Query
();
$this
->
parser
=
new
Parser
();
$this
->
parser
=
new
Parser
();
}
}
...
@@ -107,7 +109,7 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
...
@@ -107,7 +109,7 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
)
)
);
);
$result
=
$this
->
parser
->
parse
(
null
,
null
,
$data
);
$result
=
$this
->
parser
->
parse
(
$this
->
query
,
null
,
$data
);
$suggestions
=
$result
->
getSuggestions
();
$suggestions
=
$result
->
getSuggestions
();
$this
->
assertEquals
(
false
,
$result
->
getCorrectlySpelled
());
$this
->
assertEquals
(
false
,
$result
->
getCorrectlySpelled
());
...
@@ -156,7 +158,7 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
...
@@ -156,7 +158,7 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
)
)
);
);
$result
=
$this
->
parser
->
parse
(
null
,
null
,
$data
);
$result
=
$this
->
parser
->
parse
(
$this
->
query
,
null
,
$data
);
$suggestions
=
$result
->
getSuggestions
();
$suggestions
=
$result
->
getSuggestions
();
$this
->
assertEquals
(
false
,
$result
->
getCorrectlySpelled
());
$this
->
assertEquals
(
false
,
$result
->
getCorrectlySpelled
());
...
@@ -170,7 +172,7 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
...
@@ -170,7 +172,7 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
public
function
testParseNoData
()
public
function
testParseNoData
()
{
{
$result
=
$this
->
parser
->
parse
(
null
,
null
,
array
());
$result
=
$this
->
parser
->
parse
(
$this
->
query
,
null
,
array
());
$this
->
assertEquals
(
null
,
$result
);
$this
->
assertEquals
(
null
,
$result
);
}
}
...
...
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