Commit ac46a00b authored by Bas de Nooijer's avatar Bas de Nooijer

Merge branch 'psr-2-fixes' of github.com:smoench/solarium into develop

Conflicts:
	library/Solarium/Plugin/BufferedAdd/BufferedAdd.php
parents 31a011ce 260818e4
......@@ -161,8 +161,8 @@ class ZendHttp extends Configurable implements AdapterInterface
*
* @throws HttpException
* @throws OutOfBoundsException
* @param Request $request
* @param Endpoint $endpoint
* @param Request $request
* @param Endpoint $endpoint
* @return Response
*/
public function execute($request, $endpoint)
......
......@@ -769,8 +769,8 @@ class Client extends Configurable
/**
* Execute a query
*
* @param QueryInterface $query
* @param Endpoint|string|null $endpoint
* @param QueryInterface $query
* @param Endpoint|string|null $endpoint
* @return ResultInterface
*/
public function execute(QueryInterface $query, $endpoint = null)
......@@ -838,8 +838,8 @@ class Client extends Configurable
* @internal This is a convenience method that forwards the query to the
* execute method, thus allowing for an easy to use and clean API.
*
* @param QueryInterface|\Solarium\QueryType\Ping\Query $query
* @param Endpoint|string|null $endpoint
* @param QueryInterface|\Solarium\QueryType\Ping\Query $query
* @param Endpoint|string|null $endpoint
* @return \Solarium\QueryType\Ping\Result
*/
public function ping(QueryInterface $query, $endpoint = null)
......@@ -864,8 +864,8 @@ class Client extends Configurable
* @internal This is a convenience method that forwards the query to the
* execute method, thus allowing for an easy to use and clean API.
*
* @param QueryInterface|\Solarium\QueryType\Update\Query\Query $query
* @param Endpoint|string|null $endpoint
* @param QueryInterface|\Solarium\QueryType\Update\Query\Query $query
* @param Endpoint|string|null $endpoint
* @return \Solarium\QueryType\Update\Result
*/
public function update(QueryInterface $query, $endpoint = null)
......@@ -889,8 +889,8 @@ class Client extends Configurable
* @internal This is a convenience method that forwards the query to the
* execute method, thus allowing for an easy to use and clean API.
*
* @param QueryInterface|\Solarium\QueryType\Select\Query\Query $query
* @param Endpoint|string|null $endpoint
* @param QueryInterface|\Solarium\QueryType\Select\Query\Query $query
* @param Endpoint|string|null $endpoint
* @return \Solarium\QueryType\Select\Result\Result
*/
public function select(QueryInterface $query, $endpoint = null)
......@@ -914,8 +914,8 @@ class Client extends Configurable
* @internal This is a convenience method that forwards the query to the
* execute method, thus allowing for an easy to use and clean API.
*
* @param QueryInterface|\Solarium\QueryType\MoreLikeThis\Query $query
* @param Endpoint|string|null $endpoint
* @param QueryInterface|\Solarium\QueryType\MoreLikeThis\Query $query
* @param Endpoint|string|null $endpoint
* @return \Solarium\QueryType\MoreLikeThis\Result
*/
public function moreLikeThis(QueryInterface $query, $endpoint = null)
......@@ -929,8 +929,8 @@ class Client extends Configurable
* @internal This is a convenience method that forwards the query to the
* execute method, thus allowing for an easy to use and clean API.
*
* @param QueryInterface|\Solarium\QueryType\Analysis\Query\Document|\Solarium\QueryType\Analysis\Query\Field $query
* @param Endpoint|string|null $endpoint
* @param QueryInterface|\Solarium\QueryType\Analysis\Query\Document|\Solarium\QueryType\Analysis\Query\Field $query
* @param Endpoint|string|null $endpoint
* @return \Solarium\QueryType\Analysis\Result\Document|\Solarium\QueryType\Analysis\Result\Field
*/
public function analyze(QueryInterface $query, $endpoint = null)
......@@ -944,8 +944,8 @@ class Client extends Configurable
* @internal This is a convenience method that forwards the query to the
* execute method, thus allowing for an easy to use and clean API.
*
* @param QueryInterface|\Solarium\QueryType\Terms\Query $query
* @param Endpoint|string|null $endpoint
* @param QueryInterface|\Solarium\QueryType\Terms\Query $query
* @param Endpoint|string|null $endpoint
* @return \Solarium\QueryType\Terms\Result
*/
public function terms(QueryInterface $query, $endpoint = null)
......@@ -959,8 +959,8 @@ class Client extends Configurable
* @internal This is a convenience method that forwards the query to the
* execute method, thus allowing for an easy to use and clean API.
*
* @param QueryInterface|\Solarium\QueryType\Suggester\Query $query
* @param Endpoint|string|null $endpoint
* @param QueryInterface|\Solarium\QueryType\Suggester\Query $query
* @param Endpoint|string|null $endpoint
* @return \Solarium\QueryType\Suggester\Result\Result
*/
public function suggester(QueryInterface $query, $endpoint = null)
......@@ -974,8 +974,8 @@ class Client extends Configurable
* @internal This is a convenience method that forwards the query to the
* execute method, thus allowing for an easy to use and clean API.
*
* @param QueryInterface|\Solarium\QueryType\Extract\Query $query
* @param Endpoint|string|null $endpoint
* @param QueryInterface|\Solarium\QueryType\Extract\Query $query
* @param Endpoint|string|null $endpoint
* @return \Solarium\QueryType\Extract\Result
*/
public function extract(QueryInterface $query, $endpoint = null)
......@@ -989,8 +989,8 @@ class Client extends Configurable
* @internal This is a convenience method that forwards the query to the
* execute method, thus allowing for an easy to use and clean API.
*
* @param QueryInterface|\Solarium\QueryType\RealtimeGet\Query $query
* @param Endpoint|string|null $endpoint
* @param QueryInterface|\Solarium\QueryType\RealtimeGet\Query $query
* @param Endpoint|string|null $endpoint
* @return \Solarium\QueryType\RealtimeGet\Result
*/
public function realtimeGet(QueryInterface $query, $endpoint = null)
......@@ -1137,7 +1137,7 @@ class Client extends Configurable
/**
* Create a RealtimeGet query instance
*
* @param mixed $options
* @param mixed $options
* @return \Solarium\QueryType\RealtimeGet\Query
*/
public function createRealtimeGet($options = null)
......
......@@ -325,7 +325,7 @@ class Request extends Configurable
* Set the file to upload via "multipart/form-data" POST request
*
* @throws RuntimeException
* @param string $filename Name of file to upload
* @param string $filename Name of file to upload
* @return self
*/
public function setFileUpload($filename)
......
......@@ -87,7 +87,7 @@ class Configurable implements ConfigurableInterface
* @throws InvalidArgumentException
* @param array|\Zend_Config $options
* @param boolean $overwrite True for overwriting existing options, false
* for merging (new values overwrite old ones if needed)
* for merging (new values overwrite old ones if needed)
*
* @return void
*/
......
......@@ -60,7 +60,7 @@ interface ConfigurableInterface
* @throws InvalidArgumentException
* @param array|\Zend_Config $options
* @param boolean $overwrite True for overwriting existing options, false
* for merging (new values overwrite old ones if needed)
* for merging (new values overwrite old ones if needed)
*
* @return void
*/
......
......@@ -40,7 +40,6 @@ namespace Solarium\Core\Plugin;
use Solarium\Core\Client\Client;
use Solarium\Core\Configurable;
use Solarium\Core\Query\Query;
/**
* Base class for plugins
......
......@@ -40,7 +40,6 @@ namespace Solarium\Core\Plugin;
use Solarium\Core\ConfigurableInterface;
use Solarium\Core\Client\Client;
use Solarium\Core\Query\Query;
/**
* Interface for plugins
......
......@@ -38,7 +38,6 @@
*/
namespace Solarium\Core\Query;
use Solarium\Core\Query\Query;
use Solarium\Exception\InvalidArgumentException;
/**
......@@ -358,6 +357,7 @@ class Helper
foreach ($params as $key => $value) {
$this->query->addParam($key, $value);
}
return $name . '()';
} else {
return $name . '(' . implode($params, ',') . ')';
......@@ -454,8 +454,8 @@ class Helper
*
* @see http://wiki.apache.org/solr/SolrQuerySyntax#Other_built-in_useful_query_parsers
*
* @param string $field
* @param float $weight
* @param string $field
* @param float $weight
* @return string
*/
public function qparserTerm($field, $weight)
......@@ -470,8 +470,8 @@ class Helper
*
* @see http://wiki.apache.org/solr/CommonQueryParameters#Caching_of_filters
*
* @param boolean $useCache
* @param float|null $cost
* @param boolean $useCache
* @param float|null $cost
* @return string
*/
public function cacheControl($useCache, $cost = null)
......
......@@ -38,7 +38,6 @@
*/
namespace Solarium\Core\Query;
use Solarium\Core\Query\Helper;
use Solarium\Core\Configurable;
/**
......
......@@ -38,7 +38,6 @@
*/
namespace Solarium\Core\Query;
use Solarium\Core\Query\Helper;
use Solarium\Core\ConfigurableInterface;
/**
......
......@@ -38,9 +38,7 @@
*/
namespace Solarium\Core\Query;
use Solarium\Core\Query\Query;
use Solarium\Core\Client\Request;
use Solarium\Core\Query\QueryInterface;
/**
* Class for building Solarium client requests
......
......@@ -38,7 +38,6 @@
*/
namespace Solarium\Core\Query;
use Solarium\Core\Query\QueryInterface;
use Solarium\Core\Client\Request;
/**
......
......@@ -485,8 +485,8 @@ class Loadbalancer extends Plugin
* Execute a request using the adapter
*
* @throws RuntimeException
* @param Request $request
* @return Response $response
* @param Request $request
* @return Response $response
*/
protected function getLoadbalancedResponse($request)
{
......
......@@ -52,7 +52,7 @@ class RequestBuilder extends BaseRequestBuilder
/**
* Build request for an analysis query
*
* @param QueryInterface|Query $query
* @param QueryInterface|Query $query
* @return Request
*/
public function build(QueryInterface $query)
......
......@@ -39,7 +39,6 @@
namespace Solarium\QueryType\Analysis\Result;
use Solarium\Core\Query\Result\QueryType as BaseResult;
use Solarium\QueryType\Analysis\Result\ResultList;
/**
* Analysis document query result
......
......@@ -413,8 +413,8 @@ class Query extends BaseQuery
* You can optionally directly supply the fields and boosts
* to get a ready-made document instance for direct use in an add command
*
* @param array $fields
* @param array $boosts
* @param array $fields
* @param array $boosts
* @return DocumentInterface
*/
public function createDocument($fields = array(), $boosts = array())
......
......@@ -42,7 +42,6 @@ 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
......
......@@ -50,7 +50,7 @@ class RequestBuilder extends BaseRequestBuilder
/**
* Build request for a ping query
*
* @param QueryInterface|Query $query
* @param QueryInterface|Query $query
* @return Request
*/
public function build(QueryInterface $query)
......
......@@ -56,6 +56,7 @@ class Result extends BaseResult implements \IteratorAggregate, \Countable
public function getDocument()
{
$docs = $this->getDocuments();
return reset($docs);
}
}
......@@ -249,7 +249,7 @@ class DistributedSearch extends Component
/**
* Add a collection
*
* @param string $key unique string
* @param string $key unique string
* @param string $collection The syntax is host:port/base_url
* @return self Provides fluent interface
* @link http://wiki.apache.org/solr/SolrCloud/
......
......@@ -97,7 +97,6 @@ class Pivot extends Facet
return $this->getOption('mincount');
}
/**
* Specify a field to return in the resultset
*
......@@ -116,7 +115,7 @@ class Pivot extends Facet
* Specify multiple fields to return in the resultset
*
* @param string|array $fields can be an array or string with comma
* separated fieldnames
* separated fieldnames
*
* @return self Provides fluent interface
*/
......
......@@ -159,8 +159,8 @@ class FacetSet extends Component
* Allow extraction of facets without having to define
* them on the query
*
* @param boolean $extract
* @return self Provides fluent interface
* @param boolean $extract
* @return self Provides fluent interface
*/
public function setExtractFromResponse($extract)
{
......@@ -437,9 +437,9 @@ class FacetSet extends Component
* after setting the key, by using the addFacet method.
*
* @throws OutOfBoundsException
* @param string $type
* @param array|object|null $options
* @param boolean $add
* @param string $type
* @param array|object|null $options
* @param boolean $add
* @return \Solarium\QueryType\Select\Query\Component\Facet\Facet
*/
public function createFacet($type, $options = null, $add = true)
......@@ -470,8 +470,8 @@ class FacetSet extends Component
/**
* Get a facet field instance
*
* @param mixed $options
* @param bool $add
* @param mixed $options
* @param bool $add
* @return \Solarium\QueryType\Select\Query\Component\Facet\Field
*/
public function createFacetField($options = null, $add = true)
......@@ -482,8 +482,8 @@ class FacetSet extends Component
/**
* Get a facet query instance
*
* @param mixed $options
* @param bool $add
* @param mixed $options
* @param bool $add
* @return \Solarium\QueryType\Select\Query\Component\Facet\Query
*/
public function createFacetQuery($options = null, $add = true)
......@@ -494,8 +494,8 @@ class FacetSet extends Component
/**
* Get a facet multiquery instance
*
* @param mixed $options
* @param bool $add
* @param mixed $options
* @param bool $add
* @return \Solarium\QueryType\Select\Query\Component\Facet\MultiQuery
*/
public function createFacetMultiQuery($options = null, $add = true)
......@@ -506,8 +506,8 @@ class FacetSet extends Component
/**
* Get a facet range instance
*
* @param mixed $options
* @param bool $add
* @param mixed $options
* @param bool $add
* @return \Solarium\QueryType\Select\Query\Component\Facet\Range
*/
public function createFacetRange($options = null, $add = true)
......@@ -518,8 +518,8 @@ class FacetSet extends Component
/**
* Get a facet pivot instance
*
* @param mixed $options
* @param bool $add
* @param mixed $options
* @param bool $add
* @return \Solarium\QueryType\Select\Query\Component\Facet\Pivot
*/
public function createFacetPivot($options = null, $add = true)
......
......@@ -188,7 +188,7 @@ class Highlighting extends Component
* Add multiple fields for highlighting
*
* @param string|array $fields can be an array of object instances or a string with comma
* separated fieldnames
* separated fieldnames
*
* @return self Provides fluent interface
*/
......@@ -842,8 +842,8 @@ class Highlighting extends Component
/**
* Set boundaryscannerchars option
*
* @param string $chars
* @return self Provides fluent interface
* @param string $chars
* @return self Provides fluent interface
*/
public function setBoundaryScannerChars($chars)
{
......@@ -863,8 +863,8 @@ class Highlighting extends Component
/**
* Set boundaryscannertype option
*
* @param string $type
* @return self Provides fluent interface
* @param string $type
* @return self Provides fluent interface
*/
public function setBoundaryScannerType($type)
{
......@@ -884,8 +884,8 @@ class Highlighting extends Component
/**
* Set boundaryscannerlanguage option
*
* @param string $language
* @return self Provides fluent interface
* @param string $language
* @return self Provides fluent interface
*/
public function setBoundaryScannerLanguage($language)
{
......@@ -905,8 +905,8 @@ class Highlighting extends Component
/**
* Set boundaryscannercountry option
*
* @param string $country
* @return self Provides fluent interface
* @param string $country
* @return self Provides fluent interface
*/
public function setBoundaryScannerCountry($country)
{
......
......@@ -373,16 +373,16 @@ class Spellcheck extends Component
return $this->getOption('accuracy');
}
/**
* Set a collation param
* @param string $param
* @param mixed $value
* @return self Provides fluent interface
* @param string $param
* @param mixed $value
* @return self Provides fluent interface
*/
public function setCollateParam($param, $value)
{
$this->collateParams[$param] = $value;
return $this;
}
......
......@@ -52,13 +52,6 @@ class Field extends Configurable
*/
protected $facets = array();
/**
* Exclude tags for this stat
*
* @var array
*/
protected $excludes = array();
/**
* Initialize options
*
......@@ -74,13 +67,6 @@ class Field extends Configurable
case 'facet':
$this->setFacets($value);
break;
case 'exclude':
if (!is_array($value)) {
$value = array($value);
}
$this->setExcludes($value);
unset($this->options['exclude']);
break;
}
}
}
......@@ -123,7 +109,7 @@ class Field extends Configurable
* Specify multiple facets to return in the resultset
*
* @param string|array $facets can be an array or string with comma
* separated facetnames
* separated facetnames
*
* @return self Provides fluent interface
*/
......@@ -193,83 +179,4 @@ class Field extends Configurable
return $this;
}
/**
* Add an exclude tag
*
* @param string $tag
* @return self Provides fluent interface
*/
public function addExclude($tag)
{
$this->excludes[$tag] = true;
return $this;
}
/**
* Add multiple exclude tags
*
* @param array $excludes
* @return self Provides fluent interface
*/
public function addExcludes(array $excludes)
{
foreach ($excludes as $exclude) {
$this->addExclude($exclude);
}
return $this;
}
/**
* Get all excludes
*
* @return array
*/
public function getExcludes()
{
return array_keys($this->excludes);
}
/**
* Remove a single exclude tag
*
* @param string $exclude
* @return self Provides fluent interface
*/
public function removeExclude($exclude)
{
if (isset($this->excludes[$exclude])) {
unset($this->excludes[$exclude]);
}
return $this;
}
/**
* Remove all excludes
*
* @return self Provides fluent interface
*/
public function clearExcludes()
{
$this->excludes = array();
return $this;
}
/**
* Set multiple excludes
*
* This overwrites any existing excludes
*
* @param array $excludes
*/
public function setExcludes($excludes)
{
$this->clearExcludes();
$this->addExcludes($excludes);
}
}
\ No newline at end of file
}
......@@ -288,7 +288,7 @@ class Stats extends Component
* Specify multiple facets to return in the resultset
*
* @param string|array $facets can be an array or string with comma
* separated facetnames
* separated facetnames
*
* @return self Provides fluent interface
*/
......
......@@ -451,7 +451,7 @@ class Query extends BaseQuery
* Specify multiple fields to return in the resultset
*
* @param string|array $fields can be an array or string with comma
* separated fieldnames
* separated fieldnames
*
* @return self Provides fluent interface
*/
......@@ -851,8 +851,8 @@ class Query extends BaseQuery
*
* You can remove a component by passing its key or the component instance.
*
* @param string|AbstractComponent $component
* @return self Provides fluent interface
* @param string|AbstractComponent $component
* @return self Provides fluent interface
*/
public function removeComponent($component)
{
......
......@@ -40,12 +40,11 @@ namespace Solarium\QueryType\Select\RequestBuilder\Component;
use Solarium\QueryType\Select\Query\Component\Stats\Stats as StatsComponent;
use Solarium\Core\Client\Request;
use Solarium\Core\Query\RequestBuilder;
/**
* Add select component stats to the request
*/
class Stats extends RequestBuilder
class Stats implements ComponentRequestBuilderInterface
{
/**
* Add request settings for the stats component
......@@ -62,12 +61,7 @@ class Stats extends RequestBuilder
// add fields
foreach ($component->getFields() as $field) {
$value = $this->renderLocalParams(
$field->getKey(),
array('ex' => $field->getExcludes())
);
$request->addParam('stats.field', $value);
$request->addParam('stats.field', $field->getKey());
// add field specific facet stats
foreach ($field->getFacets() as $facet) {
......@@ -82,4 +76,4 @@ class Stats extends RequestBuilder
return $request;
}
}
\ No newline at end of file
}
......@@ -144,9 +144,9 @@ class FacetSet extends ResponseParserAbstract implements ComponentParserInterfac
/**
* Add a facet result for a field facet
*
* @param Query $query
* @param QueryFacetField $facet
* @param array $data
* @param Query $query
* @param QueryFacetField $facet
* @param array $data
* @return ResultFacetField|null
*/
protected function facetField($query, $facet, $data)
......@@ -168,8 +168,8 @@ class FacetSet extends ResponseParserAbstract implements ComponentParserInterfac
/**
* Add a facet result for a facet query
*
* @param QueryFacetQuery $facet
* @param array $data
* @param QueryFacetQuery $facet
* @param array $data
* @return ResultFacetQuery|null
*/
protected function facetQuery($facet, $data)
......@@ -185,8 +185,8 @@ class FacetSet extends ResponseParserAbstract implements ComponentParserInterfac
/**
* Add a facet result for a multiquery facet
*
* @param QueryFacetMultiQuery $facet
* @param array $data
* @param QueryFacetMultiQuery $facet
* @param array $data
* @return ResultFacetMultiQuery|null
*/
protected function facetMultiQuery($facet, $data)
......@@ -210,9 +210,9 @@ class FacetSet extends ResponseParserAbstract implements ComponentParserInterfac
/**
* Add a facet result for a range facet
*
* @param Query $query
* @param QueryFacetRange $facet
* @param array $data
* @param Query $query
* @param QueryFacetRange $facet
* @param array $data
* @return ResultFacetRange|null
*/
protected function facetRange($query, $facet, $data)
......@@ -240,9 +240,9 @@ class FacetSet extends ResponseParserAbstract implements ComponentParserInterfac
/**
* Add a facet result for a range facet
*
* @param Query $query
* @param QueryFacetPivot $facet
* @param array $data
* @param Query $query
* @param QueryFacetPivot $facet
* @param array $data
* @return ResultFacetPivot|null
*/
protected function facetPivot($query, $facet, $data)
......
......@@ -105,8 +105,8 @@ class Spellcheck extends ResponseParserAbstract implements ComponentParserInterf
/**
* Parse collation data into a result object
*
* @param Query $queryObject
* @param array $values
* @param Query $queryObject
* @param array $values
* @return Collation[]
*/
protected function parseCollation($queryObject, $values)
......
......@@ -38,8 +38,6 @@
*/
namespace Solarium\QueryType\Select\Result\Highlighting;
use Solarium\QueryType\Select\Result\Highlighting\Result;
/**
* Select component highlighting result
*/
......
......@@ -38,8 +38,6 @@
*/
namespace Solarium\QueryType\Select\Result\MoreLikeThis;
use Solarium\QueryType\Select\Result\MoreLikeThis\Result;
/**
* Select component morelikethis result
*/
......
......@@ -71,9 +71,9 @@ class Result implements \IteratorAggregate, \Countable
/**
* Constructor
*
* @param int $numFound
* @param float|null $maxScore
* @param array $documents
* @param int $numFound
* @param float|null $maxScore
* @param array $documents
*/
public function __construct($numFound, $maxScore, $documents)
{
......
......@@ -40,7 +40,6 @@ namespace Solarium\QueryType\Select\Result;
use Solarium\QueryType\Select\Query\Query as SelectQuery;
use Solarium\Core\Query\Result\QueryType as BaseResult;
use Solarium\QueryType\Select\Result\DocumentInterface;
/**
* Select query result
......
......@@ -38,9 +38,6 @@
*/
namespace Solarium\QueryType\Select\Result\Spellcheck;
use Solarium\QueryType\Select\Result\Spellcheck\Collation;
use Solarium\QueryType\Select\Result\Spellcheck\Suggestion;
/**
* Select component spellcheck result
*/
......
......@@ -46,11 +46,11 @@ class Suggestion
/**
* Constructor
*
* @param int $numFound
* @param int $startOffset
* @param int $endOffset
* @param int $originalFrequency
* @param array $words
* @param int $numFound
* @param int $startOffset
* @param int $endOffset
* @param int $originalFrequency
* @param array $words
*/
public function __construct($numFound, $startOffset, $endOffset, $originalFrequency, $words)
{
......
......@@ -38,8 +38,6 @@
*/
namespace Solarium\QueryType\Select\Result\Stats;
use Solarium\QueryType\Select\Result\Stats\Result;
/**
* Select component stats result
*/
......
......@@ -40,8 +40,6 @@ namespace Solarium\QueryType\Suggester;
use Solarium\Core\Query\Query as BaseQuery;
use Solarium\Core\Client\Client;
use Solarium\QueryType\Suggester\RequestBuilder;
use Solarium\QueryType\Suggester\ResponseParser;
/**
* Suggester Query
......
......@@ -50,7 +50,7 @@ class RequestBuilder extends BaseRequestBuilder
/**
* Build request for a Suggester query
*
* @param QueryInterface|Query $query
* @param QueryInterface|Query $query
* @return Request
*/
public function build(QueryInterface $query)
......
......@@ -40,8 +40,6 @@ namespace Solarium\QueryType\Terms;
use Solarium\Core\Client\Client;
use Solarium\Core\Query\Query as BaseQuery;
use Solarium\QueryType\Terms\RequestBuilder;
use Solarium\QueryType\Terms\ResponseParser;
/**
* Terms query
......
......@@ -53,7 +53,7 @@ class RequestBuilder extends BaseRequestBuilder
/**
* Build request for a Terms query
*
* @param QueryInterface|Query $query
* @param QueryInterface|Query $query
* @return Request
*/
public function build(QueryInterface $query)
......
......@@ -39,7 +39,6 @@
*/
namespace Solarium\QueryType\Terms;
use Solarium\QueryType\Terms\Query;
use Solarium\Core\Query\ResponseParser as ResponseParserAbstract;
use Solarium\Core\Query\ResponseParserInterface as ResponseParserInterface;
......
......@@ -381,14 +381,15 @@ class Document extends AbstractDocument implements DocumentInterface
if ($value !== null) {
$this->addField($key, $value);
}
return $this;
}
/**
* Sets the modifier type for the provided field
*
* @param string $key
* @param string $modifier
* @param string $key
* @param string $modifier
* @throws RuntimeException
* @return self
*/
......@@ -398,13 +399,14 @@ class Document extends AbstractDocument implements DocumentInterface
throw new RuntimeException('Attempt to set an atomic update modifier that is not supported');
}
$this->modifiers[$key] = $modifier;
return $this;
}
/**
* Returns the appropriate modifier for atomic updates.
*
* @param string $key
* @param string $key
* @return null|string
*/
public function getFieldModifier($key)
......@@ -434,12 +436,13 @@ class Document extends AbstractDocument implements DocumentInterface
/**
* Set version
*
* @param int $version
* @param int $version
* @return self
*/
public function setVersion($version)
{
$this->version = $version;
return $this;
}
......
......@@ -452,8 +452,8 @@ class Query extends BaseQuery
*
* This class should implement the document interface
*
* @param string $value classname
* @return self Provides fluent interface
* @param string $value classname
* @return self Provides fluent interface
*/
public function setDocumentClass($value)
{
......@@ -480,14 +480,15 @@ class Query extends BaseQuery
*
* @since 2.1.0
*
* @param array $fields
* @param array $boosts
* @param array $modifiers
* @param array $fields
* @param array $boosts
* @param array $modifiers
* @return DocumentInterface
*/
public function createDocument($fields = array(), $boosts = array(), $modifiers = array())
{
$class = $this->getDocumentClass();
return new $class($fields, $boosts, $modifiers);
}
}
......@@ -108,7 +108,7 @@ class RequestBuilder extends BaseRequestBuilder
* Build XML for an add command
*
* @param \Solarium\QueryType\Update\Query\Command\Add $command
* @param UpdateQuery $query
* @param UpdateQuery $query
* @return string
*/
public function buildAddXml($command, $query = null)
......@@ -153,10 +153,10 @@ class RequestBuilder extends BaseRequestBuilder
*
* Used in the add command
*
* @param string $name
* @param float $boost
* @param mixed $value
* @param string $modifier
* @param string $name
* @param float $boost
* @param mixed $value
* @param string $modifier
* @param UpdateQuery $query
* @return string
*/
......
......@@ -107,37 +107,4 @@ class FieldTest extends \PHPUnit_Framework_TestCase
$this->field->setFacets(array('facet3', 'facet4'));
$this->assertEquals(array('facet3', 'facet4'), $this->field->getFacets());
}
public function testAddExclude()
{
$this->field->addExclude('e1');
$this->assertEquals(array('e1'), $this->field->getExcludes());
}
public function testAddExcludes()
{
$this->field->addExcludes(array('e1', 'e2'));
$this->assertEquals(array('e1', 'e2'), $this->field->getExcludes());
}
public function testRemoveExclude()
{
$this->field->addExcludes(array('e1', 'e2'));
$this->field->removeExclude('e1');
$this->assertEquals(array('e2'), $this->field->getExcludes());
}
public function testClearExcludes()
{
$this->field->addExcludes(array('e1', 'e2'));
$this->field->clearExcludes();
$this->assertEquals(array(), $this->field->getExcludes());
}
public function testSetExcludes()
{
$this->field->addExcludes(array('e1', 'e2'));
$this->field->setExcludes(array('e3', 'e4'));
$this->assertEquals(array('e3', 'e4'), $this->field->getExcludes());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment