Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
385 commits
Select commit Hold shift + click to select a range
cb367b3
move solarium stuff to new sub-namespace
Mar 26, 2016
10d5011
remove unused ResultSet class
Mar 26, 2016
51c23a2
add "how to index relation" guide
Mar 27, 2016
240d981
add "how to index relation" guide
Mar 27, 2016
0bb7e09
fix search in arrays
Mar 27, 2016
370354d
Allow a choice between Doctrine ORM or ODM
Apr 26, 2016
1b0294d
Ignore entities which are not documents in the show command
Apr 26, 2016
fb7f319
Test if a class is instantiable (classes might be declared as abstract)
Apr 26, 2016
660fb52
Use reflection to create a new instance and ignore constructor argurm…
Apr 26, 2016
6f94f63
Merge pull request #120 from SpinninRecordsOfficial/fix-show-command
floriansemm Apr 27, 2016
ce1b74b
Merge pull request #119 from SpinninRecordsOfficial/fix-composer-depe…
floriansemm Apr 27, 2016
bcc5916
Process large batches of entity collections
May 3, 2016
ab9de9d
Make the entity parameter optional for the index command
May 3, 2016
a99a395
Use an option for flushsize instead of an argument
May 3, 2016
fbcfad3
Add abstract method implementation to fix Travis builds
May 3, 2016
4a52bee
allow symfony3
floriansemm May 4, 2016
aa7acac
Update composer.json
floriansemm May 4, 2016
3b3526a
Update composer.json
floriansemm May 4, 2016
bdb0f1c
Update composer.json
floriansemm May 4, 2016
eeb0855
remove unused use-statement
May 9, 2016
a634393
Merge branch 'master' of https://github.com/floriansemm/SolrBundle
May 9, 2016
abd8812
fix factory-service definition
May 11, 2016
4f8ec51
Merge symfony3 branch
May 11, 2016
6186d4c
Merge branch 'fix/batched-index' of https://github.com/SpinninRecords…
May 11, 2016
b75a878
drop php54 support
May 11, 2016
2408821
Add functionality to check if a document needs to be updated based on…
May 11, 2016
afd87d5
Add functionality to check if a document needs to be updated based on…
May 11, 2016
b511894
Merge branch 'feature/entity-changeset' of github.com:SpinninRecordsO…
May 11, 2016
7ec66e9
Merge branch 'master' into feature/entity-changeset
May 11, 2016
b26c020
Changes after review comments by floriansemm
May 12, 2016
f31b9b9
Merge branch 'feature/entity-changeset' of https://github.com/Spinnin…
May 12, 2016
2c7371d
use orm-event-subscriber to avoid code-duplication
May 13, 2016
ac66eca
rework entity/document changeset stuff
May 13, 2016
0d9c223
use odm-event-subscriber to avoid code-duplication
May 13, 2016
6a359e2
fix test
May 13, 2016
7d01e4a
add more error logging
May 14, 2016
f52d6fa
allow parameters in getter property, fixes #123
May 14, 2016
d865800
Fix Symfony 2 support
May 17, 2016
d10b5e7
Merge pull request #124 from SpinninRecordsOfficial/fix-symfony-2-sup…
floriansemm May 17, 2016
ad7c93e
Fix documentation
kix May 17, 2016
d9a2aff
Merge pull request #125 from kix/docs-stylefix
floriansemm May 18, 2016
691b321
fix typo in command description
Jun 7, 2016
96bfad3
run query for given entity
Jun 7, 2016
08d40fd
fix test
Jun 7, 2016
56b266d
fix variable typo
Jun 7, 2016
097d76c
add default field
Jun 7, 2016
012f9bd
Update README.md
floriansemm Jun 8, 2016
2534e65
Update README.md
floriansemm Jun 8, 2016
91e3a5a
escape input values
Jun 10, 2016
f29e0b5
select only one row
Jun 22, 2016
880518f
make subscriber less verbose
Jun 22, 2016
c4d6e03
fix test
Jun 22, 2016
32beda5
speedup indexing, cleanup console output
Jun 24, 2016
75c3b29
fix test
Jun 24, 2016
09d9f8d
remove fullqualified classnames
Jun 25, 2016
cd377ee
add some phpdoc
Jun 25, 2016
7890901
use commit instead of flush
Jun 27, 2016
73dde0a
throw exception if hydration-mode is doctine and entity is not a doct…
Jun 28, 2016
6b381eb
Merge remote-tracking branch 'origin/master'
Jun 28, 2016
612905a
refactor plugin registration
Jun 28, 2016
276ae47
remove service classname parameters
Jun 28, 2016
009e1d0
fix tests
Jun 28, 2016
85d3165
add section how-to register solarium-listeners or plugins
floriansemm Jun 29, 2016
1275177
basic query-builder
Jul 22, 2016
667984a
incomplete tests for querybuilder
Jul 22, 2016
8dd13cc
mark `getNumFound` as deprecated, #128
Jul 22, 2016
068134d
"reactivate" getNumFound, #128
Jul 25, 2016
8714d20
implement a special doctrine-value-hydrator that skips complex-types,…
Sep 6, 2016
2ae8d06
Update README.md
floriansemm Sep 7, 2016
580e79b
integrate solr-query-builder from "minimalcode/search"
Sep 9, 2016
6d577b6
do not query id field
Sep 9, 2016
d84e0b9
add query-builder documentation
Sep 9, 2016
f23f8fa
Use identifier field names instead of column names to prevent errors
Sep 23, 2016
37865d4
Merge pull request #137 from SpinninRecordsOfficial/fix/use-field-names
floriansemm Sep 23, 2016
dd3f790
throw exception if fieldname is empty string
Oct 31, 2016
bdcc950
if hydration is index only, do not touch id fields
Oct 31, 2016
2191a92
Merge remote-tracking branch 'origin/master'
Oct 31, 2016
0d8f8e2
Merge branch 'master' into querybuilder
Nov 2, 2016
ba5af2b
fix link
Nov 2, 2016
c3b34fd
add wrapper function for querybuilder
Nov 2, 2016
8afada1
code formatting
Nov 2, 2016
d6f19ae
add querybuilder documentation
Nov 2, 2016
ea957fc
add missing parameter in `getQueryBuilder` documentation
Nov 2, 2016
1635e35
use fq for document limitation
Nov 3, 2016
9108d15
introduce query-exception
Nov 3, 2016
551e509
improve coverage
Nov 3, 2016
c0a9a97
improve coverage of Repository class
Nov 4, 2016
9495a61
remove command factory
Nov 4, 2016
53313b9
introduce entitymapper interface
Nov 4, 2016
2e060ec
use setter if no matching field was found
Nov 4, 2016
bbd6fba
code formatting
Nov 4, 2016
ae90fc6
remove exception handling to determine if a property exists
Nov 4, 2016
4866abc
fix behavior tests
Nov 4, 2016
d13d550
add cache-layer to avoid unnecessary reflection magic
Nov 4, 2016
9f8e5bf
set endpoint to populate document in the correct core, #143
Nov 9, 2016
174dd8a
entity-id was not extract correctly, entity was not fetch properly
Nov 11, 2016
17acca4
remove fq from delete-query
Nov 14, 2016
835b601
fix phpdoc, close #145
Nov 14, 2016
5a4c4de
fix typo
Nov 14, 2016
9c5be35
check if index is not empty after a single delete
Nov 14, 2016
3fd18f0
set core to null to select the default connection
Nov 14, 2016
0b3c35c
code-style fixes
Nov 14, 2016
6099dec
add tests synchronize index method
Nov 14, 2016
385ad76
do not add id filter-query multiple times, causes exception
Nov 14, 2016
f7c5735
remove class paramater, closes #146
Nov 14, 2016
f251c5d
set fieldModifier if property exists as annotation property
Nov 14, 2016
55142f8
add test for modifier field, #147
Nov 14, 2016
ff34b91
move PRE_* event dispatch
Nov 17, 2016
0f5b3bc
move 'hasChanged' logic out of solr-class to abstract indexing listen…
Nov 18, 2016
0fe01ba
load entities from orm and odm
Nov 21, 2016
4c2e544
fix behat-tests setup
Nov 21, 2016
87e9c0c
add php 7 to test matrix
Nov 21, 2016
aecf13f
remove mongodb-extension
Nov 21, 2016
b622b6f
use update to install dependencies
Nov 21, 2016
fbba39c
fix travis
Nov 21, 2016
f753db7
enhance composer update command
Nov 21, 2016
88bbc59
remove dependency to mongodb wrapper library
Nov 21, 2016
ee302bc
fix travis
Nov 21, 2016
364b492
add php 7.1 to testmatrix
Nov 21, 2016
469e39b
add php 7 to composer requirements
Nov 21, 2016
89a54b2
remove unnecessary constructor arguments
Nov 23, 2016
4a71170
add phpunit to dev-requirements
Nov 23, 2016
23cbe2b
remove tests for php5.5
Nov 23, 2016
a8d699c
add array-cache for entity properties
Dec 2, 2016
88b8b5a
rename cache property
Dec 3, 2016
6a57f91
Merge branch 'master' into partial_field_update
Dec 6, 2016
9e0a8be
add fieldModifier section, closes #147
Dec 6, 2016
e619625
update doc
Dec 6, 2016
e2ead33
add option to Id to generate a documen-id
Dec 21, 2016
536afc1
remove dependency to entity
Dec 21, 2016
61d0791
generate id
Dec 21, 2016
0a0ad50
add php 7.2
Dec 21, 2016
ce246b8
add php 7.2, no support yet
Dec 21, 2016
6752ab8
remove unused variables
Dec 21, 2016
69deae1
add documentation for new option
Dec 21, 2016
f1bf180
add branch alias for version 2.0
Dec 21, 2016
363ed4a
remove instantiation of target entity
Dec 22, 2016
ebebed9
cleanup solr-tests
Dec 22, 2016
d691f10
basic test for querybuilder construction
Dec 22, 2016
af1a5dc
cleanup fixture entities
Dec 22, 2016
4137195
cleanup fixture entities
Dec 22, 2016
2300178
Merge branch '1.6.x'
Dec 22, 2016
dfff1a5
merge and remove mapping-commands
Dec 22, 2016
78582fc
add some comments
Dec 22, 2016
0a18602
setter method must return a array or string representation for a give…
Dec 23, 2016
c32614d
remove document mapping for collection of objects in an entity, not y…
Dec 23, 2016
b336937
check if configured getter exists, if not throw exception
Dec 23, 2016
cf829d1
remove php7 return type
Dec 24, 2016
c86189f
Update README.md
jakesylvestre Dec 28, 2016
5d621b5
introduce SolrException
Dec 28, 2016
2d6dc3c
use highlevel exceptions
Dec 28, 2016
6fdd30a
drop php5 support
Dec 28, 2016
b35e293
add more information to exception-message
Dec 28, 2016
00e2fcb
Merge pull request #152 from jakesyl/patch-1
floriansemm Dec 28, 2016
8aa314d
Merge pull request #152 from jakesyl/patch-1
floriansemm Dec 28, 2016
d221691
fixes #156
Feb 2, 2017
3711994
determine object-repository on the fly, deprecate source option
Feb 2, 2017
ef43638
fixes #156
Feb 2, 2017
ef084af
determine object-repository on the fly, deprecate source option
Feb 2, 2017
6e5dad8
add start-offset option
Feb 3, 2017
fe27b03
add start-offset option
Feb 3, 2017
fa8332b
do not use phpunit provided by travis-ci
Feb 3, 2017
f0b4606
show notice if amount of entities is to large
Feb 6, 2017
f9c8206
fix tests
Feb 6, 2017
63aee3e
Merge branch '1.6.x'
Feb 7, 2017
9c46bb7
handle only highlevel exceptions
Feb 7, 2017
e0ecda9
add return types
Feb 7, 2017
e5a1517
Add scheme and dsn option. If dsn option is set, then it will resolve…
Feb 27, 2017
b30f7e8
Merge pull request #1 from drdk/feature/dsn-option
patrikorup Feb 27, 2017
3a74626
Add documentation for the DSN option
Feb 28, 2017
8340cb6
Merge pull request #2 from drdk/feature/dsn-documentation
patrikorup Feb 28, 2017
ae10ce7
Add test cases for DSN configuration
Feb 28, 2017
0304075
Rename test cases
Feb 28, 2017
29f5067
Merge pull request #159 from drdk/drdk-master
floriansemm Mar 1, 2017
a32c265
code-cleanup
Mar 1, 2017
0e58f8b
format treebuilder configuration
Mar 1, 2017
49d1990
add some phpdoc
Mar 1, 2017
8553a30
Create indexing.md
floriansemm Mar 1, 2017
0af7c32
add php example
floriansemm Mar 1, 2017
00940f3
fix formatting
floriansemm Mar 1, 2017
933079a
Update indexing.md
floriansemm Mar 1, 2017
70b9909
add another php-example
floriansemm Mar 2, 2017
05f8b30
add link to indexing tutorial
floriansemm Mar 2, 2017
3ca79a8
Update indexing.md
floriansemm Mar 3, 2017
9f4b09a
add class-documentation
Mar 6, 2017
efa2658
add a document-helper class
Mar 6, 2017
5b726d4
Don't override the solr.auto_index parameter, if it already has been …
Mar 6, 2017
8fc36b2
Merge branch '1.6.x' of github.com:floriansemm/SolrBundle into 1.6.x
Mar 6, 2017
1c1fa65
Merge pull request #161 from drdk/1.6.x
floriansemm Mar 9, 2017
321232a
cache entity if it is was instanced once
Mar 22, 2017
4f94165
Merge remote-tracking branch 'origin/1.6.x' into 1.6.x
Mar 24, 2017
30bd142
remove caching
Mar 24, 2017
7f348d1
fix tests
Mar 24, 2017
5abf461
add hint how to index documents without database
Apr 21, 2017
9426bfe
fixes #165
Jun 20, 2017
614660c
Improves the debugger icon and view
Jul 5, 2017
5232b67
use low level exception
Jul 6, 2017
e9e36e1
add request-method + request body
Jul 6, 2017
117d0da
Merge branch 'romain-pierre-debug-icon' into 1.6.x
Jul 6, 2017
e784e6d
Adds supports for Symfony 4
Nov 8, 2017
ec7b80d
Don't use ignore-platform-reqs when installing mongo-php-adapter
alcaeus Dec 8, 2017
2222808
Merge pull request #170 from alcaeus/patch-1
floriansemm Dec 29, 2017
2312aac
Merge pull request #169 from romain-pierre/symfony4
floriansemm Dec 29, 2017
8fc8a66
Merge remote-tracking branch 'origin/master'
Dec 29, 2017
1eb7dbe
Merge branch '1.6.x' into master-clone
Dec 29, 2017
e91749e
add new "nested" annotation, index nested-documents
Jan 4, 2018
d2bad96
query and block-join nested documents
Jan 5, 2018
2ac1b9c
delete root-document + nested documents
Jan 17, 2018
4d99bae
use deep-copy for object cloning
Jan 17, 2018
c4f196f
add tests for indexer
Jan 17, 2018
37604f2
require version with php5 support
Jan 17, 2018
850ef4c
remove void return type
Jan 17, 2018
c55e9e4
remove void return type
Jan 17, 2018
653c1fd
Update composer.json
floriansemm Jan 18, 2018
6e64915
use getter to handle other data-types than objects, fixes #171
Jan 22, 2018
b57b329
do not index nested documents directly
Jan 22, 2018
c667677
show if document is nested
Jan 22, 2018
c282b85
show mapping information about nested fields
Jan 22, 2018
ca867a6
Merge branch 'master' into nested_documents
Jan 22, 2018
74976b3
move mapper tests with complex values to dedicated test-suite
Jan 22, 2018
febeed8
refactor documentation
Jan 22, 2018
af6ca04
index one-to-one relation
Jan 22, 2018
a3139c9
add edge-case
Jan 22, 2018
65ed341
remove old testcase
Jan 22, 2018
a53c886
cleanup fixtures classes
Jan 22, 2018
7114856
cleanup fixtures classes
Jan 23, 2018
6cc4171
remove old code
Jan 23, 2018
7375875
add point field configuration
Feb 7, 2018
8aaa4dc
methods with field annotation will be used as virtual-field
Feb 8, 2018
9f7866d
Update composer.json
floriansemm Apr 4, 2018
b50ff73
revert SF2 "support"
floriansemm Apr 4, 2018
b61486a
Improves compatibility with Symfony 4
Apr 4, 2018
dac64cb
Merge pull request #176 from romain-pierre/master
floriansemm Apr 27, 2018
14626ff
SF4 fix path to profiler template
floriansemm Apr 27, 2018
5ac7ce8
fix icon in profiler-toolbar
floriansemm May 24, 2018
e4ed044
Fixes the services definitions for commands
Jun 28, 2018
6ee33da
Added greater and less than functions.
jkwakman Jul 4, 2018
6599d89
Update QueryBuilderInterface.php
jkwakman Jul 4, 2018
4b63ad3
Merge pull request #177 from symcaster/fix/commands
floriansemm Jul 16, 2018
28b4342
Merge pull request #178 from jkwakman/jkwakman-gt-lt-query-builder
floriansemm Jul 16, 2018
96fce07
add tests, remove string escaping in case of nested field query
Oct 25, 2018
1d2cfa3
fix test
Nov 12, 2018
677cea5
merge master, resolve conflicts in "solr.html.twig"
Nov 12, 2018
49cb335
Merge pull request #190 from floriansemm/nested_documents
floriansemm Nov 12, 2018
633b91c
hotfix: catch exception if no document-declaration was found in norma…
Nov 15, 2018
8e39b0a
index only entities with document-declaration
Nov 15, 2018
b071b0e
do not index empty collections
Nov 15, 2018
8a7c2db
use phpunit-testclass for integration tests
Nov 16, 2018
dab273a
handle arrays a relations-value properly
Nov 16, 2018
fc28cee
add php7.3 to test queue
Nov 16, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Created by .ignore support plugin (hsz.mobi)
### Composer template
composer.phar
vendor/
bin/

# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock


28 changes: 14 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
language: php

services: mongodb
sudo: false

php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3

before_script:
- echo "extension=mongo.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`
- curl -s http://getcomposer.org/installer | php
- php composer.phar install --dev
- curl -sSL https://raw.githubusercontent.com/moliware/travis-solr/master/travis-solr.sh | SOLR_VERSION=4.8.0 bash
- curl -sSL https://raw.githubusercontent.com/floriansemm/travis-solr/master/travis-solr.sh | SOLR_CORE=core0 DEBUG=1 SOLR_VERSION=4.8.0 SOLR_CONFS="Tests/Resources/config/schema.xml" bash

install:
- composer self-update
- if [[ ${TRAVIS_PHP_VERSION:0:2} == "5." ]]; then yes '' | pecl -q install -f mongo; fi
- if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]]; then pecl install -f mongodb; fi
- if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]]; then composer config "platform.ext-mongo" "1.6.16" && composer require alcaeus/mongo-php-adapter; fi
- composer update

script:
- phpunit
notifications:
email:
- fsemm.travis-ci@gmx.de
- ./bin/phpunit
2 changes: 1 addition & 1 deletion Client/Builder.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
namespace FS\SolrBundle\Client;

namespace FS\SolrBundle\Client;

interface Builder
{
Expand Down
74 changes: 74 additions & 0 deletions Client/Solarium/Plugin/LoggerPlugin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?php

namespace FS\SolrBundle\Client\Solarium\Plugin;

use FS\SolrBundle\Logging\SolrLoggerInterface;
use Solarium\Core\Client\Client;
use Solarium\Core\Event\Events;
use Solarium\Core\Event\PreExecuteRequest;
use Solarium\Core\Plugin\AbstractPlugin;

/**
* Registers a logger to collection data about request
*/
class LoggerPlugin extends AbstractPlugin
{
/**
* @var SolrLoggerInterface
*/
protected $logger;

/**
* @param SolrLoggerInterface $logger
*/
public function __construct(SolrLoggerInterface $logger)
{
$this->logger = $logger;
}

/**
* {@inheritdoc}
*/
protected function initPluginType()
{
$dispatcher = $this->client->getEventDispatcher();
$dispatcher->addListener(Events::PRE_EXECUTE_REQUEST, [$this, 'preExecuteRequest']);
$dispatcher->addListener(Events::POST_EXECUTE_REQUEST, [$this, 'postExecuteRequest']);
}

/**
* @param PreExecuteRequest $event
*/
public function preExecuteRequest(PreExecuteRequest $event)
{
$endpoint = $event->getEndpoint();
$request = $event->getRequest();
$uri = $request->getUri();

$path = sprintf('%s://%s:%s%s/%s', $endpoint->getScheme(), $endpoint->getHost(), $endpoint->getPort(), $endpoint->getPath(), urldecode($uri));

$requestInformation = [
'uri' => $path,
'method' => $request->getMethod(),
'raw_data' => $request->getRawData()
];

$this->logger->startRequest($requestInformation);
}

/**
* Issue stop logger
*/
public function postExecuteRequest()
{
$this->logger->stopRequest();
}

/**
* @return Client
*/
public function getClient()
{
return $this->client;
}
}
39 changes: 39 additions & 0 deletions Client/Solarium/Plugin/RequestDebugger.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace FS\SolrBundle\Client\Solarium\Plugin;

use Psr\Log\LoggerInterface;
use Solarium\Core\Event\Events;
use Solarium\Core\Event\PreExecuteRequest;
use Solarium\Core\Plugin\AbstractPlugin;

/**
* Listens on solarium.core.preExecuteRequest event
*/
class RequestDebugger extends AbstractPlugin
{

/**
* @var LoggerInterface
*/
private $logger;

/**
* @param LoggerInterface $logger
*/
public function __construct(LoggerInterface $logger)
{
$this->logger = $logger;

parent::__construct();
}

/**
* @param PreExecuteRequest $event
*/
public function preExecuteRequest(PreExecuteRequest $event)
{
$this->logger->info(sprintf('run request: %s', urldecode($event->getRequest()->getUri())));
}

}
92 changes: 92 additions & 0 deletions Client/Solarium/SolariumClientBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php

namespace FS\SolrBundle\Client\Solarium;

use FS\SolrBundle\Client\Builder;
use Solarium\Client;
use Solarium\Core\Plugin\AbstractPlugin;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

/**
* Creates an instance of the Solarium Client
*/
class SolariumClientBuilder implements Builder
{
/**
* @var array
*/
private $settings = array();

/**
* @var AbstractPlugin[]
*/
private $plugins = array();

/**
* @var EventDispatcherInterface
*/
private $eventDispatcher;

/**
* @param array $settings
* @param EventDispatcherInterface $eventDispatcher
*/
public function __construct(array $settings, EventDispatcherInterface $eventDispatcher)
{
$this->settings = $settings;
$this->eventDispatcher = $eventDispatcher;
}

/**
* @param string $pluginName
* @param AbstractPlugin $plugin
*/
public function addPlugin($pluginName, AbstractPlugin $plugin)
{
$this->plugins[$pluginName] = $plugin;
}

/**
* {@inheritdoc}
*
* @return Client
*/
public function build()
{
$settings = [];
foreach ($this->settings as $name => $options) {
if (isset($options['dsn'])) {
unset(
$options['scheme'],
$options['host'],
$options['port'],
$options['path']
);

$parsedDsn = parse_url($options['dsn']);
unset($options['dsn']);
if ($parsedDsn) {
$options['scheme'] = isset($parsedDsn['scheme']) ? $parsedDsn['scheme'] : 'http';
if (isset($parsedDsn['host'])) {
$options['host'] = $parsedDsn['host'];
}
if (isset($parsedDsn['user'])) {
$auth = $parsedDsn['user'] . (isset($parsedDsn['pass']) ? ':' . $parsedDsn['pass'] : '');
$options['host'] = $auth . '@' . $options['host'];
}
$options['port'] = isset($parsedDsn['port']) ? $parsedDsn['port'] : 80;
$options['path'] = isset($parsedDsn['path']) ? $parsedDsn['path'] : '';
}
}

$settings[$name] = $options;
}

$solariumClient = new Client(array('endpoint' => $settings), $this->eventDispatcher);
foreach ($this->plugins as $pluginName => $plugin) {
$solariumClient->registerPlugin($pluginName, $plugin);
}

return $solariumClient;
}
}
23 changes: 16 additions & 7 deletions Client/Client.php → Client/Solarium/SolariumMulticoreClient.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
<?php

namespace FS\SolrBundle\Client;
namespace FS\SolrBundle\Client\Solarium;

use FS\SolrBundle\Doctrine\Mapper\MetaInformationInterface;
use FS\SolrBundle\Query\DeleteDocumentQuery;
use FS\SolrBundle\Query\FindByIdentifierQuery;
use Solarium\Core\Query\QueryInterface;
use Solarium\QueryType\Update\Query\Document\DocumentInterface;
use \Solarium\Client as SolariumClient;
use \Solarium\Client;

/**
* Wrapper class for \Solarium\Client to perform actions on multiple cores
*/
class Client
class SolariumMulticoreClient
{
/**
* @var SolariumClient
* @var Client
*/
private $solariumClient;

/**
* @param SolariumClient $solariumClient
* @param Client $solariumClient
*/
public function __construct(SolariumClient $solariumClient)
public function __construct(Client $solariumClient)
{
$this->solariumClient = $solariumClient;
}
Expand All @@ -44,8 +46,12 @@ public function update(DocumentInterface $doc, $index)
*/
public function delete(DocumentInterface $document, $index)
{
$deleteQuery = new FindByIdentifierQuery();
$documentFields = $document->getFields();
$documentKey = $documentFields[MetaInformationInterface::DOCUMENT_KEY_FIELD_NAME];

$deleteQuery = new DeleteDocumentQuery();
$deleteQuery->setDocument($document);
$deleteQuery->setDocumentKey($documentKey);

$delete = $this->solariumClient->createUpdate();
$delete->addDeleteQuery($deleteQuery->getQuery());
Expand All @@ -54,6 +60,9 @@ public function delete(DocumentInterface $document, $index)
$this->applyQuery($delete, $index);
}

/**
* Runs a *:* delete query on all cores
*/
public function clearCores()
{
$delete = $this->solariumClient->createUpdate();
Expand Down
32 changes: 0 additions & 32 deletions Client/SolrBuilder.php

This file was deleted.

Loading