Skip to content

Commit

Permalink
Merge pull request #418 from solariumphp/develop
Browse files Browse the repository at this point in the history
Merging develop to master for new release
  • Loading branch information
basdenooijer committed May 3, 2016
2 parents 3cc70c8 + f71a6a6 commit b945cbe
Show file tree
Hide file tree
Showing 23 changed files with 948 additions and 69 deletions.
2 changes: 0 additions & 2 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
service_name: travis-ci

src_dir: library
11 changes: 8 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,25 @@ env:
- SYMFONY_VERSION=2.3.*
- SYMFONY_VERSION=2.7.*
- SYMFONY_VERSION=2.8.*
- SYMFONY_VERSION=3.0.* # Does not work with php below 5.5

before_script:
- 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"
- composer require --prefer-source --dev symfony/event-dispatcher:${SYMFONY_VERSION}

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

after_script: vendor/bin/coveralls -v
after_success:
- travis_retry php vendor/bin/coveralls -v

matrix:
exclude:
- php: 5.3
env: SYMFONY_VERSION=3.0.*
- php: 5.4
env: SYMFONY_VERSION=3.0.*
allow_failures:
- php: 5.3
- php: hhvm
- php: nightly


sudo: false
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# CHANGELOG


## 3.6.0

- improvement: no longer allow failures for HHVM in continuous integration
- improvement: added Symfony 3.x components to CI tests for PHP 5.5+
- added: support for replicas in distributed search
- added: support for multiple boost queries in dismax
- added: support for additional stats values like percentiles
- improvement: several typo / markup fixes in documentation
- improvement: several docblock fixes
- improvement: ClientInterface now also used for standard Client class

## 3.5.1

- fix backwards incompatible change in classnames

## 3.5.0 - 2015-12-09

- improvement: lots of code style fixes
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
],
"require": {
"php": ">=5.3.2",
"symfony/event-dispatcher": "~2.3"
"symfony/event-dispatcher": "~2.3|~3.0"
},
"require-dev": {
"phpunit/phpunit": "~3.7",
"squizlabs/php_codesniffer": "~1.4",
"zendframework/zendframework1": "~1.12",
"satooshi/php-coveralls": "~0.6"
"satooshi/php-coveralls": "~1.0"
},
"extra": {
"branch-alias": {
Expand Down
40 changes: 26 additions & 14 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,27 @@ See [<https://packagist.org>](https://packagist.org) for other packages.

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

`  {`
`      "require": {`
`          "solarium/solarium": "2.4.0"`
`      }`
`  }`
```json
{
"require": {
"solarium/solarium": "2.4.0"
}
}
```

- Run composer install

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

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

```
Also you need to make sure the the Symfony Event Dispatcher component is available.

### Checking the availability

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
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
<?php

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

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").

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
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
<?php

$config = array(
Expand All @@ -110,7 +114,9 @@ $config = array(

### Selecting documents

This is the basic example of executing a select query and displaying the results: ```php
This is the basic example of executing a select query and displaying the results:

```php
<?php

require(__DIR__.'/init.php');
Expand Down Expand Up @@ -203,7 +209,9 @@ htmlFooter();

### Deleting documents

Documents can be deleted with a query: ```php
Documents can be deleted with a query:

```php
<?php

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

```

Or by id ```php
Or by id

```php
<?php

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

### Adding documents

This example adds some documents to the index: ```php
This example adds some documents to the index:

```php
<?php

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

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.

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)
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)
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Solarium documentation

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

- 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.
- 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.
- Allow for reuse, for instance a query can be extended to modify it
- 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.
- 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.
Expand Down Expand Up @@ -37,4 +37,4 @@ foreach ($resultset as $document) {
echo $document->id . PHP_EOL;
echo $document->name . PHP_EOL;
}
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Options
| shards | string | null | Shards to use for request |
| shardhandler | string | null | Request handler to use |
| collections | string | null | A list of collections, for use with SolrCloud (available in Solarium 3.1+) |
| replicas | string | null | A list of replicas, for use with SolrCloud (available in Solarium 3.1+) |
||

Example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ The countable interface returns the number of documents in this resultset. This
Example
-------

A basic usage example: ```php
A basic usage example:
```php
<?php

require(__DIR__.'/init.php');
Expand Down
2 changes: 1 addition & 1 deletion library/Solarium/Core/Client/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
* $result = $client->select($query);
* </code>
*/
class Client extends Configurable
class Client extends Configurable implements ClientInterface
{
/**
* Querytype select.
Expand Down
130 changes: 130 additions & 0 deletions library/Solarium/QueryType/Select/Query/Component/BoostQuery.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<?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 <[email protected]>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
*
* @link http://www.solarium-project.org/
*/

/**
* @namespace
*/

namespace Solarium\QueryType\Select\Query\Component;

use Solarium\Core\Configurable;
use Solarium\Core\Query\Helper;

/**
* Filterquery.
*
* @link http://wiki.apache.org/solr/CommonQueryParameters#fq
*/
class BoostQuery extends Configurable
{
/**
* Query.
*
* @var string
*/
protected $query;

/**
* Get key value.
*
* @return string
*/
public function getKey()
{
return $this->getOption('key');
}

/**
* Set key value.
*
* @param string $value
*
* @return self Provides fluent interface
*/
public function setKey($value)
{
return $this->setOption('key', $value);
}

/**
* Set the query string.
*
* This overwrites the current value
*
* @param string $query
* @param array $bind Bind values for placeholders in the query string
*
* @return self Provides fluent interface
*/
public function setQuery($query, $bind = null)
{
if (!is_null($bind)) {
$helper = new Helper();
$query = $helper->assemble($query, $bind);
}

$this->query = trim($query);

return $this;
}

/**
* Get the query string.
*
* @return string
*/
public function getQuery()
{
return $this->query;
}

/**
* Initialize options.
*/
protected function init()
{
foreach ($this->options as $name => $value) {
switch ($name) {
case 'key':
$this->setKey($value);
break;
case 'query':
$this->setQuery($value);
break;
}
}
}
}
Loading

0 comments on commit b945cbe

Please sign in to comment.