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
fc819735
Commit
fc819735
authored
Sep 10, 2012
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved var type resolving for IDEs (improves autocompletion and readability of the code)
parent
c9cb5264
Changes
33
Show whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
251 additions
and
87 deletions
+251
-87
library/Solarium/Core/Client/Client.php
library/Solarium/Core/Client/Client.php
+1
-1
library/Solarium/QueryType/Analysis/Query/Document.php
library/Solarium/QueryType/Analysis/Query/Document.php
+3
-3
library/Solarium/QueryType/Analysis/RequestBuilder/Document.php
...y/Solarium/QueryType/Analysis/RequestBuilder/Document.php
+3
-2
library/Solarium/QueryType/Analysis/ResponseParser/Document.php
...y/Solarium/QueryType/Analysis/ResponseParser/Document.php
+1
-1
library/Solarium/QueryType/Analysis/Result/Types.php
library/Solarium/QueryType/Analysis/Result/Types.php
+7
-0
library/Solarium/QueryType/MoreLikeThis/Result.php
library/Solarium/QueryType/MoreLikeThis/Result.php
+11
-0
library/Solarium/QueryType/Select/Query/Component/Component.php
...y/Solarium/QueryType/Select/Query/Component/Component.php
+4
-2
library/Solarium/QueryType/Select/Query/Component/Facet/MultiQuery.php
...ium/QueryType/Select/Query/Component/Facet/MultiQuery.php
+2
-1
library/Solarium/QueryType/Select/Query/Component/Stats/Stats.php
...Solarium/QueryType/Select/Query/Component/Stats/Stats.php
+1
-1
library/Solarium/QueryType/Select/Query/Query.php
library/Solarium/QueryType/Select/Query/Query.php
+4
-4
library/Solarium/QueryType/Select/RequestBuilder/Component/ComponentRequestBuilderInterface.php
...estBuilder/Component/ComponentRequestBuilderInterface.php
+55
-0
library/Solarium/QueryType/Select/RequestBuilder/Component/Debug.php
...arium/QueryType/Select/RequestBuilder/Component/Debug.php
+1
-1
library/Solarium/QueryType/Select/RequestBuilder/Component/DisMax.php
...rium/QueryType/Select/RequestBuilder/Component/DisMax.php
+1
-1
library/Solarium/QueryType/Select/RequestBuilder/Component/DistributedSearch.php
...ype/Select/RequestBuilder/Component/DistributedSearch.php
+1
-1
library/Solarium/QueryType/Select/RequestBuilder/Component/EdisMax.php
...ium/QueryType/Select/RequestBuilder/Component/EdisMax.php
+1
-1
library/Solarium/QueryType/Select/RequestBuilder/Component/FacetSet.php
...um/QueryType/Select/RequestBuilder/Component/FacetSet.php
+1
-1
library/Solarium/QueryType/Select/RequestBuilder/Component/Grouping.php
...um/QueryType/Select/RequestBuilder/Component/Grouping.php
+1
-1
library/Solarium/QueryType/Select/RequestBuilder/Component/Highlighting.php
...ueryType/Select/RequestBuilder/Component/Highlighting.php
+2
-2
library/Solarium/QueryType/Select/RequestBuilder/Component/MoreLikeThis.php
...ueryType/Select/RequestBuilder/Component/MoreLikeThis.php
+1
-1
library/Solarium/QueryType/Select/RequestBuilder/Component/Spellcheck.php
.../QueryType/Select/RequestBuilder/Component/Spellcheck.php
+1
-1
library/Solarium/QueryType/Select/RequestBuilder/Component/Stats.php
...arium/QueryType/Select/RequestBuilder/Component/Stats.php
+1
-1
library/Solarium/QueryType/Select/ResponseParser/Component/ComponentParserInterface.php
...ect/ResponseParser/Component/ComponentParserInterface.php
+55
-0
library/Solarium/QueryType/Select/ResponseParser/Component/Debug.php
...arium/QueryType/Select/ResponseParser/Component/Debug.php
+18
-13
library/Solarium/QueryType/Select/ResponseParser/Component/FacetSet.php
...um/QueryType/Select/ResponseParser/Component/FacetSet.php
+21
-15
library/Solarium/QueryType/Select/ResponseParser/Component/Grouping.php
...um/QueryType/Select/ResponseParser/Component/Grouping.php
+10
-7
library/Solarium/QueryType/Select/ResponseParser/Component/Highlighting.php
...ueryType/Select/ResponseParser/Component/Highlighting.php
+7
-6
library/Solarium/QueryType/Select/ResponseParser/Component/MoreLikeThis.php
...ueryType/Select/ResponseParser/Component/MoreLikeThis.php
+6
-5
library/Solarium/QueryType/Select/ResponseParser/Component/Spellcheck.php
.../QueryType/Select/ResponseParser/Component/Spellcheck.php
+11
-7
library/Solarium/QueryType/Select/ResponseParser/Component/Stats.php
...arium/QueryType/Select/ResponseParser/Component/Stats.php
+1
-1
library/Solarium/QueryType/Select/ResponseParser/ResponseParser.php
...larium/QueryType/Select/ResponseParser/ResponseParser.php
+5
-0
library/Solarium/QueryType/Suggester/ResponseParser.php
library/Solarium/QueryType/Suggester/ResponseParser.php
+2
-1
library/Solarium/QueryType/Terms/ResponseParser.php
library/Solarium/QueryType/Terms/ResponseParser.php
+8
-2
library/Solarium/QueryType/Update/Query/Command/Add.php
library/Solarium/QueryType/Update/Query/Command/Add.php
+4
-4
No files found.
library/Solarium/Core/Client/Client.php
View file @
fc819735
...
...
@@ -948,7 +948,7 @@ class Client extends Configurable
*
* @param \Solarium\QueryType\Extract\Query $query
* @param Endpoint|string|null
* @return \Solarium\QueryType\Extract\Result
\Result
* @return \Solarium\QueryType\Extract\Result
*/
public
function
extract
(
QueryInterface
$query
,
$endpoint
=
null
)
{
...
...
library/Solarium/QueryType/Analysis/Query/Document.php
View file @
fc819735
...
...
@@ -40,7 +40,7 @@ namespace Solarium\QueryType\Analysis\Query;
use
Solarium\Core\Client\Client
;
use
Solarium\QueryType\Analysis\ResponseParser\Document
as
ResponseParser
;
use
Solarium\QueryType\Analysis\RequestBuilder\Document
as
RequestBuilder
;
use
Solarium\QueryType\Select\Result\Document
Interface
;
use
Solarium\QueryType\Select\Result\Document
as
ResultDocument
;
/**
* Analysis document query
...
...
@@ -51,7 +51,7 @@ class Document extends Query
/**
* Documents to analyze
*
* @var
DocumentInterface
[]
* @var
ResultDocument
[]
*/
protected
$documents
=
array
();
...
...
@@ -125,7 +125,7 @@ class Document extends Query
/**
* Get all documents
*
* @return
DocumentInterface
[]
* @return
ResultDocument
[]
*/
public
function
getDocuments
()
{
...
...
library/Solarium/QueryType/Analysis/RequestBuilder/Document.php
View file @
fc819735
...
...
@@ -39,6 +39,7 @@
namespace
Solarium\QueryType\Analysis\RequestBuilder
;
use
Solarium\Core\Query\RequestBuilder
as
BaseRequestBuilder
;
use
Solarium\Core\Client\Request
;
use
Solarium\QueryType\Analysis\Query\Document
as
QueryDocument
;
use
Solarium\Core\Query\QueryInterface
;
/**
...
...
@@ -50,7 +51,7 @@ class Document extends BaseRequestBuilder
/**
* Build request for an analysis document query
*
* @param Document $query
* @param
Query
Document $query
* @return Request
*/
public
function
build
(
QueryInterface
$query
)
...
...
@@ -65,7 +66,7 @@ class Document extends BaseRequestBuilder
/**
* Create the raw post data (xml)
*
* @param Document $query
* @param
Query
Document $query
* @return string
*/
public
function
getRawData
(
$query
)
...
...
library/Solarium/QueryType/Analysis/ResponseParser/Document.php
View file @
fc819735
...
...
@@ -49,7 +49,7 @@ class Document extends Field
/**
* Parse implementation
*
* @param
Result
$result
* @param
array
$result
* @param array $data
* @return ResultList[]
*/
...
...
library/Solarium/QueryType/Analysis/Result/Types.php
View file @
fc819735
...
...
@@ -44,6 +44,13 @@ namespace Solarium\QueryType\Analysis\Result;
class
Types
extends
ResultList
{
/**
* List items
*
* @var ResultList[]
*/
protected
$items
;
/**
* Get index analysis list
*
...
...
library/Solarium/QueryType/MoreLikeThis/Result.php
View file @
fc819735
...
...
@@ -41,6 +41,7 @@ namespace Solarium\QueryType\MoreLikeThis;
use
Solarium\QueryType\Select\Result\Document
as
ReadOnlyDocument
;
use
Solarium\QueryType\Select\Result\Result
as
SelectResult
;
use
Solarium\Exception\UnexpectedValueException
;
use
Solarium\QueryType\MoreLikeThis\Query
;
/**
* MoreLikeThis query result
...
...
@@ -71,6 +72,16 @@ class Result extends SelectResult
*/
protected
$match
;
/**
* Get query instance
*
* @return Query
*/
public
function
getQuery
()
{
return
$this
->
query
;
}
/**
* Get MLT interesting terms
*
...
...
library/Solarium/QueryType/Select/Query/Component/Component.php
View file @
fc819735
...
...
@@ -39,6 +39,8 @@
namespace
Solarium\QueryType\Select\Query\Component
;
use
Solarium\Core\Configurable
;
use
Solarium\Core\Query\Query
;
use
Solarium\QueryType\Select\ResponseParser\Component\ComponentParserInterface
;
use
Solarium\QueryType\Select\RequestBuilder\Component\ComponentRequestBuilderInterface
;
/**
* Query component base class
...
...
@@ -61,14 +63,14 @@ abstract class Component extends Configurable
/**
* Get the requestbuilder class for this query
*
* @return
object
* @return
ComponentRequestBuilderInterface
*/
abstract
public
function
getRequestBuilder
();
/**
* Get the response parser class for this query
*
* @return
object
* @return
ComponentParserInterface
*/
abstract
public
function
getResponseParser
();
...
...
library/Solarium/QueryType/Select/Query/Component/Facet/MultiQuery.php
View file @
fc819735
...
...
@@ -38,6 +38,7 @@
*/
namespace
Solarium\QueryType\Select\Query\Component\Facet
;
use
Solarium\QueryType\Select\Query\Component\FacetSet
;
use
Solarium\QueryType\Select\Query\Component\Facet\Query
as
FacetQuery
;
use
Solarium\Exception\InvalidArgumentException
;
/**
...
...
@@ -52,7 +53,7 @@ class MultiQuery extends Facet
/**
* Facet query objects
*
* @var
array
* @var
FacetQuery[]
*/
protected
$facetQueries
=
array
();
...
...
library/Solarium/QueryType/Select/Query/Component/Stats/Stats.php
View file @
fc819735
...
...
@@ -218,7 +218,7 @@ class Stats extends Component
/**
* Get all fields
*
* @return
array
* @return
Field[]
*/
public
function
getFields
()
{
...
...
library/Solarium/QueryType/Select/Query/Query.php
View file @
fc819735
...
...
@@ -835,13 +835,13 @@ class Query extends BaseQuery
* This overwrites any existing component registered with the same key.
*
* @param string $key
* @param
object|null
$component
* @param
Component
$component
* @return self Provides fluent interface
*/
public
function
setComponent
(
$key
,
$
value
)
public
function
setComponent
(
$key
,
$
component
)
{
$
value
->
setQueryInstance
(
$this
);
$this
->
components
[
$key
]
=
$
value
;
$
component
->
setQueryInstance
(
$this
);
$this
->
components
[
$key
]
=
$
component
;
return
$this
;
}
...
...
library/Solarium/QueryType/Select/RequestBuilder/Component/ComponentRequestBuilderInterface.php
0 → 100644
View file @
fc819735
<?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/
*/
/**
* @namespace
*/
namespace
Solarium\QueryType\Select\RequestBuilder\Component
;
use
Solarium\QueryType\Select\Query\Component\Component
;
use
Solarium\Core\Client\Request
;
interface
ComponentRequestBuilderInterface
{
/**
* Add request settings for the debug component
*
* @param Component $component
* @param Request $request
* @return Request
*/
public
function
buildComponent
(
$component
,
$request
);
}
library/Solarium/QueryType/Select/RequestBuilder/Component/Debug.php
View file @
fc819735
...
...
@@ -43,7 +43,7 @@ use Solarium\Core\Client\Request;
/**
* Add select component debug to the request
*/
class
Debug
class
Debug
implements
ComponentRequestBuilderInterface
{
/**
...
...
library/Solarium/QueryType/Select/RequestBuilder/Component/DisMax.php
View file @
fc819735
...
...
@@ -43,7 +43,7 @@ use Solarium\Core\Client\Request;
/**
* Add select component dismax to the request
*/
class
DisMax
class
DisMax
implements
ComponentRequestBuilderInterface
{
/**
...
...
library/Solarium/QueryType/Select/RequestBuilder/Component/DistributedSearch.php
View file @
fc819735
...
...
@@ -43,7 +43,7 @@ use Solarium\Core\Client\Request;
/**
* Add select component distributedsearch to the request
*/
class
DistributedSearch
class
DistributedSearch
implements
ComponentRequestBuilderInterface
{
/**
...
...
library/Solarium/QueryType/Select/RequestBuilder/Component/EdisMax.php
View file @
fc819735
...
...
@@ -44,7 +44,7 @@ use Solarium\Core\Client\Request;
* Add select component edismax to the request
*
*/
class
EdisMax
class
EdisMax
implements
ComponentRequestBuilderInterface
{
/**
...
...
library/Solarium/QueryType/Select/RequestBuilder/Component/FacetSet.php
View file @
fc819735
...
...
@@ -49,7 +49,7 @@ use Solarium\Exception\UnexpectedValueException;
/**
* Add select component FacetSet to the request
*/
class
FacetSet
extends
RequestBuilder
class
FacetSet
extends
RequestBuilder
implements
ComponentRequestBuilderInterface
{
/**
...
...
library/Solarium/QueryType/Select/RequestBuilder/Component/Grouping.php
View file @
fc819735
...
...
@@ -43,7 +43,7 @@ use Solarium\Core\Client\Request;
/**
* Add select component Grouping to the request
*/
class
Grouping
class
Grouping
implements
ComponentRequestBuilderInterface
{
/**
...
...
library/Solarium/QueryType/Select/RequestBuilder/Component/Highlighting.php
View file @
fc819735
...
...
@@ -44,7 +44,7 @@ use Solarium\Core\Client\Request;
/**
* Add select component Highlighting to the request
*/
class
Highlighting
class
Highlighting
implements
ComponentRequestBuilderInterface
{
/**
...
...
@@ -54,7 +54,7 @@ class Highlighting
* @param Request $request
* @return Request
*/
public
function
buildComponent
(
HighlightingComponent
$component
,
Request
$request
)
public
function
buildComponent
(
$component
,
$request
)
{
// enable highlighting
$request
->
addParam
(
'hl'
,
'true'
);
...
...
library/Solarium/QueryType/Select/RequestBuilder/Component/MoreLikeThis.php
View file @
fc819735
...
...
@@ -43,7 +43,7 @@ use Solarium\Core\Client\Request;
/**
* Add select component morelikethis to the request
*/
class
MoreLikeThis
class
MoreLikeThis
implements
ComponentRequestBuilderInterface
{
/**
...
...
library/Solarium/QueryType/Select/RequestBuilder/Component/Spellcheck.php
View file @
fc819735
...
...
@@ -43,7 +43,7 @@ use Solarium\Core\Client\Request;
/**
* Add select component Spellcheck to the request
*/
class
Spellcheck
class
Spellcheck
implements
ComponentRequestBuilderInterface
{
/**
...
...
library/Solarium/QueryType/Select/RequestBuilder/Component/Stats.php
View file @
fc819735
...
...
@@ -43,7 +43,7 @@ use Solarium\Core\Client\Request;
/**
* Add select component stats to the request
*/
class
Stats
class
Stats
implements
ComponentRequestBuilderInterface
{
/**
...
...
library/Solarium/QueryType/Select/ResponseParser/Component/ComponentParserInterface.php
0 → 100644
View file @
fc819735
<?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/
*/
/**
* @namespace
*/
namespace
Solarium\QueryType\Select\ResponseParser\Component
;
use
Solarium\QueryType\Select\Query\Query
;
interface
ComponentParserInterface
{
/**
* Parse result data into result objects
*
* @param Query $query
* @param object $component
* @param array $data
* @return object|null
*/
public
function
parse
(
$query
,
$component
,
$data
);
}
library/Solarium/QueryType/Select/ResponseParser/Component/Debug.php
View file @
fc819735
...
...
@@ -39,12 +39,17 @@
namespace
Solarium\QueryType\Select\ResponseParser\Component
;
use
Solarium\QueryType\Select\Query\Query
;
use
Solarium\QueryType\Select\Query\Component\Debug
as
DebugComponent
;
use
Solarium\QueryType\Select\Result\Debug
as
DebugResult
;
use
Solarium\QueryType\Select\Result\Debug\Result
;
use
Solarium\QueryType\Select\Result\Debug\DocumentSet
;
use
Solarium\QueryType\Select\Result\Debug\Timing
;
use
Solarium\QueryType\Select\Result\Debug\Detail
;
use
Solarium\QueryType\Select\Result\Debug\Document
;
use
Solarium\QueryType\Select\Result\Debug\TimingPhase
;
/**
* Parse select component Debug result from the data
*/
class
Debug
class
Debug
implements
ComponentParserInterface
{
/**
...
...
@@ -53,7 +58,7 @@ class Debug
* @param Query $query
* @param DebugComponent $component
* @param array $data
* @return
DebugResult\
Result|null
* @return Result|null
*/
public
function
parse
(
$query
,
$component
,
$data
)
{
...
...
@@ -72,14 +77,14 @@ class Debug
if
(
isset
(
$debug
[
'explain'
])
&&
is_array
(
$debug
[
'explain'
]))
{
$explain
=
$this
->
parseDocumentSet
(
$debug
[
'explain'
]);
}
else
{
$explain
=
new
D
ebugResult\D
ocumentSet
(
array
());
$explain
=
new
DocumentSet
(
array
());
}
// parse explainOther data
if
(
isset
(
$debug
[
'explainOther'
])
&&
is_array
(
$debug
[
'explainOther'
]))
{
$explainOther
=
$this
->
parseDocumentSet
(
$debug
[
'explainOther'
]);
}
else
{
$explainOther
=
new
D
ebugResult\D
ocumentSet
(
array
());
$explainOther
=
new
DocumentSet
(
array
());
}
// parse timing data
...
...
@@ -96,11 +101,11 @@ class Debug
$timingPhases
[
$key
]
=
$this
->
parseTimingPhase
(
$key
,
$timingData
);
}
}
$timing
=
new
DebugResult\
Timing
(
$time
,
$timingPhases
);
$timing
=
new
Timing
(
$time
,
$timingPhases
);
}
// create result object
$result
=
new
DebugResult\
Result
(
$result
=
new
Result
(
$queryString
,
$parsedQuery
,
$queryParser
,
...
...
@@ -120,7 +125,7 @@ class Debug
* Used for explain and explainOther
*
* @param array $data
* @return D
ebugResult\D
ocumentSet
* @return DocumentSet
*/
protected
function
parseDocumentSet
(
$data
)
{
...
...
@@ -130,7 +135,7 @@ class Debug
$details
=
array
();
if
(
isset
(
$documentData
[
'details'
])
&&
is_array
(
$documentData
[
'details'
]))
{
foreach
(
$documentData
[
'details'
]
as
$detailData
)
{
$details
[]
=
new
De
bugResult\De
tail
(
$details
[]
=
new
Detail
(
$detailData
[
'match'
],
$detailData
[
'value'
],
$detailData
[
'description'
]
...
...
@@ -138,7 +143,7 @@ class Debug
}
}
$docs
[
$key
]
=
new
D
ebugResult\D
ocument
(
$docs
[
$key
]
=
new
Document
(
$key
,
$documentData
[
'match'
],
$documentData
[
'value'
],
...
...
@@ -147,7 +152,7 @@ class Debug
);
}
return
new
D
ebugResult\D
ocumentSet
(
$docs
);
return
new
DocumentSet
(
$docs
);
}
/**
...
...
@@ -155,7 +160,7 @@ class Debug
*
* @param string $name
* @param array $data
* @return
DebugResult\
TimingPhase
* @return TimingPhase
*/
protected
function
parseTimingPhase
(
$name
,
$data
)
{
...
...
@@ -171,7 +176,7 @@ class Debug
}
}
return
new
DebugResult\
TimingPhase
(
$name
,
$time
,
$classes
);
return
new
TimingPhase
(
$name
,
$time
,
$classes
);
}
}
library/Solarium/QueryType/Select/ResponseParser/Component/FacetSet.php
View file @
fc819735
...
...
@@ -39,16 +39,22 @@
namespace
Solarium\QueryType\Select\ResponseParser\Component
;
use
Solarium\QueryType\Select\Query\Query
;
use
Solarium\QueryType\Select\Query\Component\FacetSet
as
QueryFacetSet
;
use
Solarium\QueryType\Select\Query\Component\Facet
as
QueryFacet
;
use
Solarium\QueryType\Select\Query\Component\Facet\Field
as
QueryFacetField
;
use
Solarium\QueryType\Select\Query\Component\Facet\Query
as
QueryFacetQuery
;
use
Solarium\QueryType\Select\Query\Component\Facet\MultiQuery
as
QueryFacetMultiQuery
;
use
Solarium\QueryType\Select\Query\Component\Facet\Range
as
QueryFacetRange
;
use
Solarium\QueryType\Select\Result\FacetSet
as
ResultFacetSet
;
use
Solarium\QueryType\Select\Result\Facet
as
ResultFacet
;
use
Solarium\QueryType\Select\Result\Facet\Field
as
ResultFacetField
;
use
Solarium\QueryType\Select\Result\Facet\Query
as
ResultFacetQuery
;
use
Solarium\QueryType\Select\Result\Facet\MultiQuery
as
ResultFacetMultiQuery
;
use
Solarium\QueryType\Select\Result\Facet\Range
as
ResultFacetRange
;
use
Solarium\Exception\RuntimeException
;
use
Solarium\Core\Query\ResponseParser
as
ResponseParserAbstract
;
/**
* Parse select component FacetSet result from the data
*/
class
FacetSet
extends
ResponseParserAbstract
class
FacetSet
extends
ResponseParserAbstract
implements
ComponentParserInterface
{
/**
...
...
@@ -104,9 +110,9 @@ class FacetSet extends ResponseParserAbstract
* Add a facet result for a field facet
*
* @param Query $query
* @param QueryFacet
\
Field $facet
* @param QueryFacetField $facet
* @param array $data
* @return ResultFacet
\
Field
* @return ResultFacetField
*/
protected
function
facetField
(
$query
,
$facet
,
$data
)
{
...
...
@@ -117,16 +123,16 @@ class FacetSet extends ResponseParserAbstract
$data
[
'facet_counts'
][
'facet_fields'
][
$key
]
=
$this
->
convertToKeyValueArray
(
$data
[
'facet_counts'
][
'facet_fields'
][
$key
]);
}
return
new
ResultFacet
\
Field
(
$data
[
'facet_counts'
][
'facet_fields'
][
$key
]);
return
new
ResultFacetField
(
$data
[
'facet_counts'
][
'facet_fields'
][
$key
]);
}
}
/**
* Add a facet result for a facet query
*
* @param QueryFacet
\
Query $facet
* @param QueryFacetQuery $facet
* @param array $data
* @return ResultFacet
\
Query
* @return ResultFacetQuery
*/
protected
function
facetQuery
(
$facet
,
$data
)
{
...
...
@@ -135,16 +141,16 @@ class FacetSet extends ResponseParserAbstract
$value
=
$data
[
'facet_counts'
][
'facet_queries'
][
$key
];
return
new
ResultFacet
\
Query
(
$value
);
return
new
ResultFacetQuery
(
$value
);
}
}
/**
* Add a facet result for a multiquery facet
*
* @param QueryFacet
\
MultiQuery $facet
* @param QueryFacetMultiQuery $facet
* @param array $data
* @return ResultFacet
\
MultiQuery
* @return ResultFacetMultiQuery
*/
protected
function
facetMultiQuery
(
$facet
,
$data
)
{
...
...
@@ -158,7 +164,7 @@ class FacetSet extends ResponseParserAbstract
}
if
(
count
(
$values
)
>
0
)
{
return
new
ResultFacet
\
MultiQuery
(
$values
);
return
new
ResultFacetMultiQuery
(
$values
);
}
}
...
...
@@ -166,9 +172,9 @@ class FacetSet extends ResponseParserAbstract
* Add a facet result for a range facet
*
* @param Query $query
* @param QueryFacet
\
Range $facet
* @param QueryFacetRange $facet
* @param array $data
* @return ResultFacet
\
Range
* @return ResultFacetRange
*/
protected
function
facetRange
(
$query
,
$facet
,
$data
)
{
...
...
@@ -187,7 +193,7 @@ class FacetSet extends ResponseParserAbstract
$data
[
'counts'
]
=
$this
->
convertToKeyValueArray
(
$data
[
'counts'
]);
}
return
new
ResultFacet
\
Range
(
$data
[
'counts'
],
$before
,
$after
,
$between
,
$start
,
$end
,
$gap
);
return
new
ResultFacetRange
(
$data
[
'counts'
],
$before
,
$after
,
$between
,
$start
,
$end
,
$gap
);
}
}
...
...
library/Solarium/QueryType/Select/ResponseParser/Component/Grouping.php
View file @
fc819735
...
...
@@ -39,12 +39,15 @@
namespace
Solarium\QueryType\Select\ResponseParser\Component
;
use
Solarium\QueryType\Select\Query\Query
;
use
Solarium\QueryType\Select\Query\Component\Grouping
as
GroupingComponent
;
use
Solarium\QueryType\Select\Result\Grouping
as
GroupingResult
;
use
Solarium\QueryType\Select\Result\Grouping\Result
;
use
Solarium\QueryType\Select\Result\Grouping\ValueGroup
;
use
Solarium\QueryType\Select\Result\Grouping\QueryGroup
;
use
Solarium\QueryType\Select\Result\Grouping\FieldGroup
;
/**
* Parse select component Grouping result from the data
*/
class
Grouping
class
Grouping
implements
ComponentParserInterface
{
/**
...
...
@@ -53,7 +56,7 @@ class Grouping
* @param Query $query
* @param GroupingComponent $grouping
* @param array $data
* @return
GroupingResult\
Result
* @return Result
*/
public
function
parse
(
$query
,
$grouping
,
$data
)
{
...
...
@@ -91,12 +94,12 @@ class Grouping
}
}
$valueGroups
[]
=
new
GroupingResult\
ValueGroup
(
$valueGroups
[]
=
new
ValueGroup
(
$value
,
$numFound
,
$start
,
$documents
);
}
$groups
[
$field
]
=
new
GroupingResult\
FieldGroup
(
$groups
[
$field
]
=
new
FieldGroup
(
$matches
,
$groupCount
,
$valueGroups
);
}
...
...
@@ -123,7 +126,7 @@ class Grouping
}
// create a group result object
$group
=
new
GroupingResult\
QueryGroup
(
$group
=
new
QueryGroup
(
$matches
,
$numFound
,
$start
,
$maxScore
,
$documents
);
$groups
[
$groupQuery
]
=
$group
;
...
...
@@ -131,6 +134,6 @@ class Grouping
}
}
return
new
GroupingResult\
Result
(
$groups
);
return
new
Result
(
$groups
);
}
}
library/Solarium/QueryType/Select/ResponseParser/Component/Highlighting.php
View file @
fc819735
...
...
@@ -38,13 +38,14 @@
*/
namespace
Solarium\QueryType\Select\ResponseParser\Component
;
use
Solarium\QueryType\Select\Query\Query
;
use
Solarium\QueryType\Select\Query\Component\Highlighting
as
HighlightingComponent
;
use
Solarium\QueryType\Select\Result\Highlighting
as
HighlightingResult
;
use
Solarium\QueryType\Select\Query\Component\Highlighting\Highlighting
as
HighlightingComponent
;
use
Solarium\QueryType\Select\Result\Highlighting\Highlighting
as
HighlightingResult
;
use
Solarium\QueryType\Select\Result\Highlighting\Result
;
/**
* Parse select component Highlighting result from the data
*/
class
Highlighting
class
Highlighting
implements
ComponentParserInterface
{
/**
...
...
@@ -53,7 +54,7 @@ class Highlighting
* @param Query $query
* @param HighlightingComponent $highlighting
* @param array $data
* @return HighlightingResult
\Highlighting
* @return HighlightingResult
*/
public
function
parse
(
$query
,
$highlighting
,
$data
)
{
...
...
@@ -62,12 +63,12 @@ class Highlighting
$highlightResults
=
$data
[
'highlighting'
];
foreach
(
$highlightResults
as
$key
=>
$result
)
{
$results
[
$key
]
=
new
HighlightingResult\
Result
(
$results
[
$key
]
=
new
Result
(
$result
);
}
}
return
new
HighlightingResult
\Highlighting
(
$results
);
return
new
HighlightingResult
(
$results
);
}
}
library/Solarium/QueryType/Select/ResponseParser/Component/MoreLikeThis.php
View file @
fc819735
...
...
@@ -39,12 +39,13 @@
namespace
Solarium\QueryType\Select\ResponseParser\Component
;
use
Solarium\QueryType\Select\Query\Query
;
use
Solarium\QueryType\Select\Query\Component\MoreLikeThis
as
MoreLikeThisComponent
;
use
Solarium\QueryType\Select\Result\MoreLikeThis
as
MoreLikeThisResult
;
use
Solarium\QueryType\Select\Result\MoreLikeThis\Result
;
use
Solarium\QueryType\Select\Result\MoreLikeThis\MoreLikeThis
as
MoreLikeThisResult
;
/**
* Parse select component MoreLikeThis result from the data
*/
class
MoreLikeThis
class
MoreLikeThis
implements
ComponentParserInterface
{
/**
...
...
@@ -53,7 +54,7 @@ class MoreLikeThis
* @param Query $query
* @param MoreLikeThisComponent $moreLikeThis
* @param array $data
* @return MoreLikeThis
Result\MoreLikeThis
* @return MoreLikeThis
*/
public
function
parse
(
$query
,
$moreLikeThis
,
$data
)
{
...
...
@@ -71,7 +72,7 @@ class MoreLikeThis
$docs
[]
=
new
$documentClass
(
$fields
);
}
$results
[
$key
]
=
new
MoreLikeThisResult\
Result
(
$results
[
$key
]
=
new
Result
(
$result
[
'numFound'
],
$result
[
'maxScore'
],
$docs
...
...
@@ -79,6 +80,6 @@ class MoreLikeThis
}
}
return
new
MoreLikeThisResult
\MoreLikeThis
(
$results
);
return
new
MoreLikeThisResult
(
$results
);
}
}
library/Solarium/QueryType/Select/ResponseParser/Component/Spellcheck.php
View file @
fc819735
...
...
@@ -40,12 +40,16 @@ namespace Solarium\QueryType\Select\ResponseParser\Component;
use
Solarium\QueryType\Select\Query\Query
;
use
Solarium\QueryType\Select\Query\Component\Spellcheck
as
SpellcheckComponent
;
use
Solarium\QueryType\Select\Result\Spellcheck
as
SpellcheckResult
;
use
Solarium\QueryType\Select\Result\Spellcheck\Result
;
use
Solarium\QueryType\Select\Result\Spellcheck\Collation
;
use
Solarium\QueryType\Select\Result\Spellcheck\Suggestion
;
use
Solarium\Core\Query\ResponseParser
as
ResponseParserAbstract
;
/**
* Parse select component Highlighting result from the data
*/
class
Spellcheck
extends
ResponseParserAbstract
class
Spellcheck
extends
ResponseParserAbstract
implements
ComponentParserInterface
{
/**
...
...
@@ -54,7 +58,7 @@ class Spellcheck extends ResponseParserAbstract
* @param Query $query
* @param SpellcheckComponent $spellcheck
* @param array $data
* @return
SpellcheckResult\
Result|null
* @return Result|null
*/
public
function
parse
(
$query
,
$spellcheck
,
$data
)
{
...
...
@@ -104,13 +108,13 @@ class Spellcheck extends ResponseParserAbstract
*
* @param Query $queryObject
* @param array $values
* @return
SpellcheckResult\
Collation
* @return Collation
*/
protected
function
parseCollation
(
$queryObject
,
$values
)
{
if
(
is_string
(
$values
))
{
return
new
SpellcheckResult\
Collation
(
$values
,
null
,
array
());
return
new
Collation
(
$values
,
null
,
array
());
}
else
{
...
...
@@ -148,7 +152,7 @@ class Spellcheck extends ResponseParserAbstract
}
}
return
new
SpellcheckResult\
Collation
(
$query
,
$hits
,
$corrections
);
return
new
Collation
(
$query
,
$hits
,
$corrections
);
}
}
...
...
@@ -157,7 +161,7 @@ class Spellcheck extends ResponseParserAbstract
*
* @param string $key
* @param array $value
* @return S
pellcheckResult\S
uggestion
* @return Suggestion
*/
protected
function
parseSuggestion
(
$key
,
$value
)
{
...
...
@@ -174,7 +178,7 @@ class Spellcheck extends ResponseParserAbstract
$frequency
=
$value
[
'suggestion'
][
0
][
'freq'
];
}
return
new
S
pellcheckResult\S
uggestion
(
return
new
Suggestion
(
$numFound
,
$startOffset
,
$endOffset
,
$originalFrequency
,
$word
,
$frequency
);
}
...
...
library/Solarium/QueryType/Select/ResponseParser/Component/Stats.php
View file @
fc819735
...
...
@@ -46,7 +46,7 @@ use Solarium\QueryType\Select\Result\Stats\FacetValue as ResultStatsFacetValue;
/**
* Parse select component Stats result from the data
*/
class
Stats
class
Stats
implements
ComponentParserInterface
{
/**
...
...
library/Solarium/QueryType/Select/ResponseParser/ResponseParser.php
View file @
fc819735
...
...
@@ -41,6 +41,7 @@ use Solarium\Core\Query\ResponseParser as ResponseParserAbstract;
use
Solarium\Core\Query\ResponseParserInterface
as
ResponseParserInterface
;
use
Solarium\QueryType\Select\Result\Result
;
use
Solarium\Exception\RuntimeException
;
use
Solarium\QueryType\Select\Query\Query
;
/**
* Parse select response data
...
...
@@ -58,6 +59,10 @@ class ResponseParser extends ResponseParserAbstract implements ResponseParserInt
public
function
parse
(
$result
)
{
$data
=
$result
->
getData
();
/**
* @var $query Query
*/
$query
=
$result
->
getQuery
();
// create document instances
...
...
library/Solarium/QueryType/Suggester/ResponseParser.php
View file @
fc819735
...
...
@@ -40,6 +40,7 @@
namespace
Solarium\QueryType\Suggester
;
use
Solarium\Core\Query\ResponseParser
as
ResponseParserAbstract
;
use
Solarium\Core\Query\ResponseParserInterface
as
ResponseParserInterface
;
use
Solarium\QueryType\Suggester\Result\Result
;
/**
* Parse Suggester response data
...
...
@@ -50,7 +51,7 @@ class ResponseParser extends ResponseParserAbstract implements ResponseParserInt
/**
* Get result data for the response
*
* @param Result
/Result
$result
* @param Result $result
* @return array
*/
public
function
parse
(
$result
)
...
...
library/Solarium/QueryType/Terms/ResponseParser.php
View file @
fc819735
...
...
@@ -38,11 +38,12 @@
* @namespace
*/
namespace
Solarium\QueryType\Terms
;
use
Solarium\QueryType\Terms\Query
;
use
Solarium\Core\Query\ResponseParser
as
ResponseParserAbstract
;
use
Solarium\Core\Query\ResponseParserInterface
as
ResponseParserInterface
;
/**
* Parse
MoreLikeThi
s response data
* Parse
Term
s response data
*/
class
ResponseParser
extends
ResponseParserAbstract
implements
ResponseParserInterface
{
...
...
@@ -58,7 +59,12 @@ class ResponseParser extends ResponseParserAbstract implements ResponseParserInt
$termResults
=
array
();
$data
=
$result
->
getData
();
/**
* @var $query Query
*/
$query
=
$result
->
getQuery
();
foreach
(
$query
->
getFields
()
as
$field
)
{
$field
=
trim
(
$field
);
if
(
isset
(
$data
[
'terms'
][
$field
]))
{
...
...
library/Solarium/QueryType/Update/Query/Command/Add.php
View file @
fc819735
...
...
@@ -38,7 +38,7 @@
*/
namespace
Solarium\QueryType\Update\Query\Command
;
use
Solarium\QueryType\Update\Query\Query
as
UpdateQuery
;
use
Solarium\QueryType\Update\Query\Document
Interface
;
use
Solarium\QueryType\Update\Query\Document
;
use
Solarium\Exception\RuntimeException
;
/**
...
...
@@ -70,12 +70,12 @@ class Add extends Command
* Add a single document
*
* @throws RuntimeException
* @param Document
Interface
$document
* @param Document $document
* @return self Provides fluent interface
*/
public
function
addDocument
(
$document
)
{
if
(
!
(
$document
instanceof
Document
Interface
))
{
if
(
!
(
$document
instanceof
Document
))
{
throw
new
RuntimeException
(
'Documents must implement the document interface'
);
}
...
...
@@ -115,7 +115,7 @@ class Add extends Command
/**
* Get all documents
*
* @return Document
Interface
[]
* @return Document[]
*/
public
function
getDocuments
()
{
...
...
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