Skip to content

Commit b945cbe

Browse files
committed
Merge pull request #418 from solariumphp/develop
Merging develop to master for new release
2 parents 3cc70c8 + f71a6a6 commit b945cbe

File tree

23 files changed

+948
-69
lines changed

23 files changed

+948
-69
lines changed

.coveralls.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
service_name: travis-ci
2-
3-
src_dir: library

.travis.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,25 @@ env:
1313
- SYMFONY_VERSION=2.3.*
1414
- SYMFONY_VERSION=2.7.*
1515
- SYMFONY_VERSION=2.8.*
16+
- SYMFONY_VERSION=3.0.* # Does not work with php below 5.5
1617

1718
before_script:
1819
- bash -c "if [ $TRAVIS_PHP_VERSION != 'hhvm' ] && [ $TRAVIS_PHP_VERSION != '7.0' ] && [ $TRAVIS_PHP_VERSION != 'nightly' ]; then printf '\n\n\n\n' | pecl install pecl_http-1.7.6; fi"
1920
- composer require --prefer-source --dev symfony/event-dispatcher:${SYMFONY_VERSION}
2021

2122
script: vendor/bin/phpunit -c phpunit.xml.travis -v
2223

23-
after_script: vendor/bin/coveralls -v
24+
after_success:
25+
- travis_retry php vendor/bin/coveralls -v
2426

2527
matrix:
28+
exclude:
29+
- php: 5.3
30+
env: SYMFONY_VERSION=3.0.*
31+
- php: 5.4
32+
env: SYMFONY_VERSION=3.0.*
2633
allow_failures:
2734
- php: 5.3
28-
- php: hhvm
2935
- php: nightly
3036

31-
3237
sudo: false

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# CHANGELOG
22

3+
4+
## 3.6.0
5+
6+
- improvement: no longer allow failures for HHVM in continuous integration
7+
- improvement: added Symfony 3.x components to CI tests for PHP 5.5+
8+
- added: support for replicas in distributed search
9+
- added: support for multiple boost queries in dismax
10+
- added: support for additional stats values like percentiles
11+
- improvement: several typo / markup fixes in documentation
12+
- improvement: several docblock fixes
13+
- improvement: ClientInterface now also used for standard Client class
14+
15+
## 3.5.1
16+
17+
- fix backwards incompatible change in classnames
18+
319
## 3.5.0 - 2015-12-09
420

521
- improvement: lots of code style fixes

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
],
1414
"require": {
1515
"php": ">=5.3.2",
16-
"symfony/event-dispatcher": "~2.3"
16+
"symfony/event-dispatcher": "~2.3|~3.0"
1717
},
1818
"require-dev": {
1919
"phpunit/phpunit": "~3.7",
2020
"squizlabs/php_codesniffer": "~1.4",
2121
"zendframework/zendframework1": "~1.12",
22-
"satooshi/php-coveralls": "~0.6"
22+
"satooshi/php-coveralls": "~1.0"
2323
},
2424
"extra": {
2525
"branch-alias": {

docs/getting-started.md

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,27 @@ See [<https://packagist.org>](https://packagist.org) for other packages.
2525

2626
- Add Solarium to your composer.json file. It should look something like this:
2727

28-
`  {`
29-
`      "require": {`
30-
`          "solarium/solarium": "2.4.0"`
31-
`      }`
32-
`  }`
28+
```json
29+
{
30+
"require": {
31+
"solarium/solarium": "2.4.0"
32+
}
33+
}
34+
```
3335

3436
- Run composer install
3537

3638
- Make sure to use the composer autoloader, and Solarium should be available.
3739

3840
**Only if you don't use composer:** you need to use a PSR-0 autoloader, or the supplied autoloader: ```php
3941

40-
```
41-
4242
Also you need to make sure the the Symfony Event Dispatcher component is available.
4343

4444
### Checking the availability
4545

46-
To check your installation you can do a Solarium version check with the following code. If everything works you should see the version of Solarium you downloaded. To test Solr communication you can use a ping query (you might need some configuration to get the ping working, more on that later) ```php
46+
To check your installation you can do a Solarium version check with the following code. If everything works you should see the version of Solarium you downloaded. To test Solr communication you can use a ping query (you might need some configuration to get the ping working, more on that later)
47+
48+
```php
4749
<?php
4850

4951
require(__DIR__.'/init.php');
@@ -93,7 +95,9 @@ Basic usage
9395

9496
All the code display below can be found in the /examples dir of the project, where you can also easily execute the code. For more info see [Example code](V3:Example_code "wikilink").
9597

96-
All the examples use the init.php file. This file registers the Solarium autoloader and also loads the $config array for use in the client constructor. The $config array has the following contents: ```php
98+
All the examples use the init.php file. This file registers the Solarium autoloader and also loads the $config array for use in the client constructor. The $config array has the following contents:
99+
100+
```php
97101
<?php
98102

99103
$config = array(
@@ -110,7 +114,9 @@ $config = array(
110114

111115
### Selecting documents
112116

113-
This is the basic example of executing a select query and displaying the results: ```php
117+
This is the basic example of executing a select query and displaying the results:
118+
119+
```php
114120
<?php
115121

116122
require(__DIR__.'/init.php');
@@ -203,7 +209,9 @@ htmlFooter();
203209

204210
### Deleting documents
205211

206-
Documents can be deleted with a query: ```php
212+
Documents can be deleted with a query:
213+
214+
```php
207215
<?php
208216

209217
require(__DIR__.'/init.php');
@@ -230,7 +238,9 @@ htmlFooter();
230238

231239
```
232240

233-
Or by id ```php
241+
Or by id
242+
243+
```php
234244
<?php
235245

236246
require(__DIR__.'/init.php');
@@ -261,7 +271,9 @@ Also, a combination of both is possible. See the docs for more info.
261271

262272
### Adding documents
263273

264-
This example adds some documents to the index: ```php
274+
This example adds some documents to the index:
275+
276+
```php
265277
<?php
266278

267279
require(__DIR__.'/init.php');
@@ -315,4 +327,4 @@ With Solarium a set of examples is included to demonstrate the usage and to test
315327

316328
That's all! The default config file of the examples was made for the standard Solr example included with a Solr release. If you want to use a custom Solr environment you can copy the file 'config.dist.php' in the example dir to 'config.php' and correct the settings. Your environment needs to have the default Solr example schema and data for the examples to work.
317329

318-
If examples for some Solarium functionality are missing please request them by opening an issue in the issue tracker: [<http://github.com/basdenooijer/solarium/issues>](http://github.com/basdenooijer/solarium/issues)
330+
If examples for some Solarium functionality are missing please request them by opening an issue in the issue tracker: [<http://github.com/solariumphp/solarium/issues>](http://github.com/solariumphp/solarium/issues)

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Solarium documentation
44

55
Solarium is a Solr client library for PHP. It is developed with these goals in mind:
66

7-
- Releave developers of the ‘raw communication’ with Solr, ie. setting params, building strings, hiding all this with an easy to use API, allowing you to focus on business logic.
7+
- Relieve developers of the ‘raw communication’ with Solr, ie. setting params, building strings, hiding all this with an easy to use API, allowing you to focus on business logic.
88
- Allow for reuse, for instance a query can be extended to modify it
99
- Be flexible. For instance the query and result models are not tied to a specific Solr client implementation. There are multiple Solr Client adapters for Solr communication. All models can be extended by your own implementation if needed and a plugin system is available.
1010
- Be usable in any PHP application. No dependencies on other frameworks. Solarium tries to follow the Symfony 2 standard and integrates nicely with SF2, but doesn’t in rely on it. You can use Solarium just as easily in Zend Framework or any other PHP framework.
@@ -37,4 +37,4 @@ foreach ($resultset as $document) {
3737
echo $document->id . PHP_EOL;
3838
echo $document->name . PHP_EOL;
3939
}
40-
```
40+
```

docs/queries/select-query/building-a-select-query/components/distributed-search-component.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Options
88
| shards | string | null | Shards to use for request |
99
| shardhandler | string | null | Request handler to use |
1010
| collections | string | null | A list of collections, for use with SolrCloud (available in Solarium 3.1+) |
11+
| replicas | string | null | A list of replicas, for use with SolrCloud (available in Solarium 3.1+) |
1112
||
1213

1314
Example

docs/queries/select-query/result-of-a-select-query/result-of-a-select-query.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ The countable interface returns the number of documents in this resultset. This
3535
Example
3636
-------
3737

38-
A basic usage example: ```php
38+
A basic usage example:
39+
```php
3940
<?php
4041

4142
require(__DIR__.'/init.php');

library/Solarium/Core/Client/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
* $result = $client->select($query);
7979
* </code>
8080
*/
81-
class Client extends Configurable
81+
class Client extends Configurable implements ClientInterface
8282
{
8383
/**
8484
* Querytype select.
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
<?php
2+
/**
3+
* Copyright 2011 Bas de Nooijer. All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
*
8+
* 1. Redistributions of source code must retain the above copyright notice,
9+
* this list of conditions and the following disclaimer.
10+
*
11+
* 2. Redistributions in binary form must reproduce the above copyright notice,
12+
* this listof conditions and the following disclaimer in the documentation
13+
* and/or other materials provided with the distribution.
14+
*
15+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
16+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25+
* POSSIBILITY OF SUCH DAMAGE.
26+
*
27+
* The views and conclusions contained in the software and documentation are
28+
* those of the authors and should not be interpreted as representing official
29+
* policies, either expressed or implied, of the copyright holder.
30+
*
31+
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
32+
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
33+
*
34+
* @link http://www.solarium-project.org/
35+
*/
36+
37+
/**
38+
* @namespace
39+
*/
40+
41+
namespace Solarium\QueryType\Select\Query\Component;
42+
43+
use Solarium\Core\Configurable;
44+
use Solarium\Core\Query\Helper;
45+
46+
/**
47+
* Filterquery.
48+
*
49+
* @link http://wiki.apache.org/solr/CommonQueryParameters#fq
50+
*/
51+
class BoostQuery extends Configurable
52+
{
53+
/**
54+
* Query.
55+
*
56+
* @var string
57+
*/
58+
protected $query;
59+
60+
/**
61+
* Get key value.
62+
*
63+
* @return string
64+
*/
65+
public function getKey()
66+
{
67+
return $this->getOption('key');
68+
}
69+
70+
/**
71+
* Set key value.
72+
*
73+
* @param string $value
74+
*
75+
* @return self Provides fluent interface
76+
*/
77+
public function setKey($value)
78+
{
79+
return $this->setOption('key', $value);
80+
}
81+
82+
/**
83+
* Set the query string.
84+
*
85+
* This overwrites the current value
86+
*
87+
* @param string $query
88+
* @param array $bind Bind values for placeholders in the query string
89+
*
90+
* @return self Provides fluent interface
91+
*/
92+
public function setQuery($query, $bind = null)
93+
{
94+
if (!is_null($bind)) {
95+
$helper = new Helper();
96+
$query = $helper->assemble($query, $bind);
97+
}
98+
99+
$this->query = trim($query);
100+
101+
return $this;
102+
}
103+
104+
/**
105+
* Get the query string.
106+
*
107+
* @return string
108+
*/
109+
public function getQuery()
110+
{
111+
return $this->query;
112+
}
113+
114+
/**
115+
* Initialize options.
116+
*/
117+
protected function init()
118+
{
119+
foreach ($this->options as $name => $value) {
120+
switch ($name) {
121+
case 'key':
122+
$this->setKey($value);
123+
break;
124+
case 'query':
125+
$this->setQuery($value);
126+
break;
127+
}
128+
}
129+
}
130+
}

0 commit comments

Comments
 (0)