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
9a0a166f
Commit
9a0a166f
authored
Aug 07, 2012
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated plugins to use Symfony eventdispatcher
parent
19d54457
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
951 additions
and
34 deletions
+951
-34
library/Solarium/Plugin/BufferedAdd/BufferedAdd.php
library/Solarium/Plugin/BufferedAdd/BufferedAdd.php
+18
-9
library/Solarium/Plugin/BufferedAdd/Event/Events.php
library/Solarium/Plugin/BufferedAdd/Event/Events.php
+83
-0
library/Solarium/Plugin/BufferedAdd/Event/PostCommit.php
library/Solarium/Plugin/BufferedAdd/Event/PostCommit.php
+74
-0
library/Solarium/Plugin/BufferedAdd/Event/PostFlush.php
library/Solarium/Plugin/BufferedAdd/Event/PostFlush.php
+74
-0
library/Solarium/Plugin/BufferedAdd/Event/PreCommit.php
library/Solarium/Plugin/BufferedAdd/Event/PreCommit.php
+180
-0
library/Solarium/Plugin/BufferedAdd/Event/PreFlush.php
library/Solarium/Plugin/BufferedAdd/Event/PreFlush.php
+134
-0
library/Solarium/Plugin/CustomizeRequest/CustomizeRequest.php
...ary/Solarium/Plugin/CustomizeRequest/CustomizeRequest.php
+21
-4
library/Solarium/Plugin/Loadbalancer/Event/EndpointFailure.php
...ry/Solarium/Plugin/Loadbalancer/Event/EndpointFailure.php
+89
-0
library/Solarium/Plugin/Loadbalancer/Event/Events.php
library/Solarium/Plugin/Loadbalancer/Event/Events.php
+56
-0
library/Solarium/Plugin/Loadbalancer/Loadbalancer.php
library/Solarium/Plugin/Loadbalancer/Loadbalancer.php
+33
-10
library/Solarium/Plugin/ParallelExecution/Event/Events.php
library/Solarium/Plugin/ParallelExecution/Event/Events.php
+63
-0
library/Solarium/Plugin/ParallelExecution/Event/ExecuteEnd.php
...ry/Solarium/Plugin/ParallelExecution/Event/ExecuteEnd.php
+48
-0
library/Solarium/Plugin/ParallelExecution/Event/ExecuteStart.php
.../Solarium/Plugin/ParallelExecution/Event/ExecuteStart.php
+49
-0
library/Solarium/Plugin/ParallelExecution/ParallelExecution.php
...y/Solarium/Plugin/ParallelExecution/ParallelExecution.php
+9
-5
library/Solarium/Plugin/PostBigRequest.php
library/Solarium/Plugin/PostBigRequest.php
+19
-5
library/Solarium/Plugin/PrefetchIterator.php
library/Solarium/Plugin/PrefetchIterator.php
+1
-1
No files found.
library/Solarium/Plugin/BufferedAdd.php
→
library/Solarium/Plugin/BufferedAdd
/BufferedAdd
.php
View file @
9a0a166f
...
@@ -36,12 +36,17 @@
...
@@ -36,12 +36,17 @@
/**
/**
* @namespace
* @namespace
*/
*/
namespace
Solarium\Plugin
;
namespace
Solarium\Plugin
\BufferedAdd
;
use
Solarium\Client
;
use
Solarium\Client
;
use
Solarium\Core\Plugin
;
use
Solarium\Core\Plugin
\Plugin
;
use
Solarium\QueryType\Update\Result
as
UpdateResult
;
use
Solarium\QueryType\Update\Result
as
UpdateResult
;
use
Solarium\QueryType\Update\Query\Query
as
UpdateQuery
;
use
Solarium\QueryType\Update\Query\Query
as
UpdateQuery
;
use
Solarium\QueryType\Select\Result\Document
as
ReadOnlyDocument
;
use
Solarium\QueryType\Select\Result\Document
as
ReadOnlyDocument
;
use
Solarium\Plugin\BufferedAdd\Event\Events
;
use
Solarium\Plugin\BufferedAdd\Event\PreFlush
as
PreFlushEvent
;
use
Solarium\Plugin\BufferedAdd\Event\PostFlush
as
PostFlushEvent
;
use
Solarium\Plugin\BufferedAdd\Event\PreCommit
as
PreCommitEvent
;
use
Solarium\Plugin\BufferedAdd\Event\PostCommit
as
PostCommitEvent
;
/**
/**
* Buffered add plugin
* Buffered add plugin
...
@@ -194,13 +199,15 @@ class BufferedAdd extends Plugin
...
@@ -194,13 +199,15 @@ class BufferedAdd extends Plugin
return
false
;
return
false
;
}
}
$this
->
client
->
triggerEvent
(
'BufferedAddFlushStart'
,
array
(
$this
->
buffer
));
$event
=
new
PreFlushEvent
(
$this
->
buffer
,
$overwrite
,
$commitWithin
);
$this
->
client
->
getEventDispatcher
()
->
dispatch
(
Events
::
PRE_FLUSH
,
$event
);
$this
->
updateQuery
->
addDocuments
(
$
this
->
buffer
,
$overwrite
,
$commitWithin
);
$this
->
updateQuery
->
addDocuments
(
$
event
->
getBuffer
(),
$event
->
getOverwrite
(),
$event
->
getCommitWithin
()
);
$result
=
$this
->
client
->
update
(
$this
->
updateQuery
);
$result
=
$this
->
client
->
update
(
$this
->
updateQuery
);
$this
->
clear
();
$this
->
clear
();
$this
->
client
->
triggerEvent
(
'BufferedAddFlushEnd'
,
array
(
$result
));
$event
=
new
PostFlushEvent
(
$this
->
buffer
);
$this
->
client
->
getEventDispatcher
()
->
dispatch
(
Events
::
POST_FLUSH
,
$event
);
return
$result
;
return
$result
;
}
}
...
@@ -218,14 +225,16 @@ class BufferedAdd extends Plugin
...
@@ -218,14 +225,16 @@ class BufferedAdd extends Plugin
*/
*/
public
function
commit
(
$overwrite
=
null
,
$waitFlush
=
null
,
$waitSearcher
=
null
,
$expungeDeletes
=
null
)
public
function
commit
(
$overwrite
=
null
,
$waitFlush
=
null
,
$waitSearcher
=
null
,
$expungeDeletes
=
null
)
{
{
$this
->
client
->
triggerEvent
(
'BufferedAddCommitStart'
,
array
(
$this
->
buffer
));
$event
=
new
PreCommitEvent
(
$this
->
buffer
,
$overwrite
,
$waitFlush
,
$waitSearcher
,
$expungeDeletes
);
$this
->
client
->
getEventDispatcher
()
->
dispatch
(
Events
::
PRE_COMMIT
,
$event
);
$this
->
updateQuery
->
addDocuments
(
$this
->
buffer
,
$
overwrite
);
$this
->
updateQuery
->
addDocuments
(
$this
->
buffer
,
$
event
->
getOverwrite
()
);
$this
->
updateQuery
->
addCommit
(
$
waitFlush
,
$waitSearcher
,
$expungeDeletes
);
$this
->
updateQuery
->
addCommit
(
$
event
->
getWaitFlush
(),
$event
->
getWaitSearcher
(),
$event
->
getExpungeDeletes
()
);
$result
=
$this
->
client
->
update
(
$this
->
updateQuery
);
$result
=
$this
->
client
->
update
(
$this
->
updateQuery
);
$this
->
clear
();
$this
->
clear
();
$this
->
client
->
triggerEvent
(
'BufferedAddCommitEnd'
,
array
(
$result
));
$event
=
new
PostCommitEvent
(
$this
->
buffer
);
$this
->
client
->
getEventDispatcher
()
->
dispatch
(
Events
::
POST_COMMIT
,
$event
);
return
$result
;
return
$result
;
}
}
...
...
library/Solarium/Plugin/BufferedAdd/Event/Events.php
0 → 100644
View file @
9a0a166f
<?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\Plugin\BufferedAdd\Event
;
/**
* Event definitions
*/
class
Events
{
/**
* This event is called before a buffer flush
*
* The event listener receives the buffer (array).
*
* @var string
*/
const
PRE_FLUSH
=
'solarium.bufferedAdd.preFlush'
;
/**
* This event is called after a buffer flush
*
* The event listener receives the Result
*
* @var string
*/
const
POST_FLUSH
=
'solarium.bufferedAdd.postFlush'
;
/**
* This event is called before a buffer commit
*
* The event listener receives the buffer (array).
*
* @var string
*/
const
PRE_COMMIT
=
'solarium.bufferedAdd.preCommit'
;
/**
* This event is called after a buffer commit
*
* The event listener receives the Result
*
* @var string
*/
const
POST_COMMIT
=
'solarium.bufferedAdd.postCommit'
;
}
library/Solarium/Plugin/BufferedAdd/Event/PostCommit.php
0 → 100644
View file @
9a0a166f
<?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\Plugin\BufferedAdd\Event
;
use
Symfony\Component\EventDispatcher\Event
;
use
Solarium\QueryType\Update\Result
;
/**
* PostCommit event, see Events for details
*/
class
PostCommit
extends
Event
{
/**
* @var Result
*/
protected
$result
;
/**
* Event constructor
*
* @param Result $result
*/
public
function
__construct
(
$result
)
{
$this
->
result
=
$result
;
}
/**
* Get the result for this event
*
* @return array
*/
public
function
getResult
()
{
return
$this
->
result
;
}
}
library/Solarium/Plugin/BufferedAdd/Event/PostFlush.php
0 → 100644
View file @
9a0a166f
<?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\Plugin\BufferedAdd\Event
;
use
Symfony\Component\EventDispatcher\Event
;
use
Solarium\QueryType\Update\Result
;
/**
* PostFlush event, see Events for details
*/
class
PostFlush
extends
Event
{
/**
* @var Result
*/
protected
$result
;
/**
* Event constructor
*
* @param Result $result
*/
public
function
__construct
(
$result
)
{
$this
->
result
=
$result
;
}
/**
* Get the result for this event
*
* @return array
*/
public
function
getResult
()
{
return
$this
->
result
;
}
}
library/Solarium/Plugin/BufferedAdd/Event/PreCommit.php
0 → 100644
View file @
9a0a166f
<?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\Plugin\BufferedAdd\Event
;
use
Symfony\Component\EventDispatcher\Event
;
/**
* PreCommit event, see Events for details
*/
class
PreCommit
extends
Event
{
/**
* @var array
*/
protected
$buffer
;
/**
* @var boolean
*/
protected
$overwrite
;
/**
* @var boolean
*/
protected
$waitFlush
;
/**
* @var boolean
*/
protected
$waitSearcher
;
/**
* @var boolean
*/
protected
$expungeDeletes
;
/**
* Event constructor
*
* @param array $buffer
*/
public
function
__construct
(
$buffer
,
$overwrite
,
$waitFlush
,
$waitSearcher
,
$expungeDeletes
)
{
$this
->
buffer
=
$buffer
;
$this
->
overwrite
=
$overwrite
;
$this
->
waitFlush
=
$waitFlush
;
$this
->
waitSearcher
=
$waitSearcher
;
$this
->
expungeDeletes
=
$expungeDeletes
;
}
/**
* Get the buffer for this event
*
* @return array
*/
public
function
getBuffer
()
{
return
$this
->
buffer
;
}
/**
* Set the buffer for this event, this way you can alter the buffer before it is committed to Solr
*
* @param array $buffer
* @return void
*/
public
function
setBuffer
(
$buffer
)
{
$this
->
buffer
=
$buffer
;
}
/**
* Optionally override the value
*
* @param boolean $expungeDeletes
*/
public
function
setExpungeDeletes
(
$expungeDeletes
)
{
$this
->
expungeDeletes
=
$expungeDeletes
;
}
/**
* @return boolean
*/
public
function
getExpungeDeletes
()
{
return
$this
->
expungeDeletes
;
}
/**
* Optionally override the value
*
* @param boolean $overwrite
*/
public
function
setOverwrite
(
$overwrite
)
{
$this
->
overwrite
=
$overwrite
;
}
/**
* @return boolean
*/
public
function
getOverwrite
()
{
return
$this
->
overwrite
;
}
/**
* Optionally override the value
*
* @param boolean $waitFlush
*/
public
function
setWaitFlush
(
$waitFlush
)
{
$this
->
waitFlush
=
$waitFlush
;
}
/**
* @return boolean
*/
public
function
getWaitFlush
()
{
return
$this
->
waitFlush
;
}
/**
* Optionally override the value
*
* @param boolean $waitSearcher
*/
public
function
setWaitSearcher
(
$waitSearcher
)
{
$this
->
waitSearcher
=
$waitSearcher
;
}
/**
* @return boolean
*/
public
function
getWaitSearcher
()
{
return
$this
->
waitSearcher
;
}
}
library/Solarium/Plugin/BufferedAdd/Event/PreFlush.php
0 → 100644
View file @
9a0a166f
<?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\Plugin\BufferedAdd\Event
;
use
Symfony\Component\EventDispatcher\Event
;
/**
* PreFlush event, see Events for details
*/
class
PreFlush
extends
Event
{
/**
* @var array
*/
protected
$buffer
;
/**
* @var boolean
*/
protected
$overwrite
;
/**
* @var int
*/
protected
$commitWithin
;
/**
* Event constructor
*
* @param array $buffer
* @param boolean $overwrite
* @param int $commitWithin
*/
public
function
__construct
(
$buffer
,
$overwrite
,
$commitWithin
)
{
$this
->
buffer
=
$buffer
;
$this
->
overwrite
=
$overwrite
;
$this
->
commitWithin
=
$commitWithin
;
}
/**
* Get the buffer for this event
*
* @return array
*/
public
function
getBuffer
()
{
return
$this
->
buffer
;
}
/**
* Set the buffer for this event, this way you can alter the buffer before it is committed to Solr
*
* @param array $buffer
* @return void
*/
public
function
setBuffer
(
$buffer
)
{
$this
->
buffer
=
$buffer
;
}
/**
* Optionally override the value
*
* @param int $commitWithin
*/
public
function
setCommitWithin
(
$commitWithin
)
{
$this
->
commitWithin
=
$commitWithin
;
}
/**
* @return int
*/
public
function
getCommitWithin
()
{
return
$this
->
commitWithin
;
}
/**
* Optionally override the value
*
* @param boolean $overwrite
*/
public
function
setOverwrite
(
$overwrite
)
{
$this
->
overwrite
=
$overwrite
;
}
/**
* @return boolean
*/
public
function
getOverwrite
()
{
return
$this
->
overwrite
;
}
}
library/Solarium/Plugin/CustomizeRequest/CustomizeRequest.php
View file @
9a0a166f
...
@@ -37,11 +37,13 @@
...
@@ -37,11 +37,13 @@
* @namespace
* @namespace
*/
*/
namespace
Solarium\Plugin\CustomizeRequest
;
namespace
Solarium\Plugin\CustomizeRequest
;
use
Solarium\Core\Plugin
;
use
Solarium\Core\Plugin
\Plugin
;
use
Solarium\Core\Query\Query
;
use
Solarium\Core\Query\Query
;
use
Solarium\Core\Client\Request
;
use
Solarium\Core\Client\Request
;
use
Solarium\Exception\InvalidArgumentException
;
use
Solarium\Exception\InvalidArgumentException
;
use
Solarium\Exception\RuntimeException
;
use
Solarium\Exception\RuntimeException
;
use
Solarium\Core\Event\Events
;
use
Solarium\Core\Event\preExecuteRequest
as
preExecuteRequestEvent
;
/**
/**
* CustomizeRequest plugin
* CustomizeRequest plugin
...
@@ -75,6 +77,19 @@ class CustomizeRequest extends Plugin
...
@@ -75,6 +77,19 @@ class CustomizeRequest extends Plugin
}
}
}
}
/**
* Plugin init function
*
* Register event listeners
*
* @return void
*/
protected
function
initPluginType
()
{
$dispatcher
=
$this
->
client
->
getEventDispatcher
();
$dispatcher
->
addListener
(
Events
::
PRE_EXECUTE_REQUEST
,
array
(
$this
,
'preExecuteRequest'
));
}
/**
/**
* Create a Customization instance
* Create a Customization instance
*
*
...
@@ -236,12 +251,12 @@ class CustomizeRequest extends Plugin
...
@@ -236,12 +251,12 @@ class CustomizeRequest extends Plugin
* Event hook to customize the request object
* Event hook to customize the request object
*
*
* @throws RuntimeException
* @throws RuntimeException
* @param Query $query
* @param preExecuteRequestEvent $event
* @param Request $request
* @return void
* @return void
*/
*/
public
function
p
ostCreateRequest
(
$query
,
$reques
t
)
public
function
p
reExecuteRequest
(
preExecuteRequestEvent
$even
t
)
{
{
$request
=
$event
->
getRequest
();
foreach
(
$this
->
getCustomizations
()
as
$key
=>
$customization
)
{
foreach
(
$this
->
getCustomizations
()
as
$key
=>
$customization
)
{
// first validate
// first validate
...
@@ -268,6 +283,8 @@ class CustomizeRequest extends Plugin
...
@@ -268,6 +283,8 @@ class CustomizeRequest extends Plugin
$this
->
removeCustomization
(
$key
);
$this
->
removeCustomization
(
$key
);
}
}
}
}
$event
->
setRequest
(
$request
);
}
}
}
}
library/Solarium/Plugin/Loadbalancer/Event/EndpointFailure.php
0 → 100644
View file @
9a0a166f
<?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\Plugin\Loadbalancer\Event
;
use
Symfony\Component\EventDispatcher\Event
;
use
Solarium\Core\Client\Endpoint
;
use
Solarium\Exception\HttpException
;
/**
* EndpointFailure event, see Events for details
*/
class
EndpointFailure
extends
Event
{
/**
* @var Endpoint
*/
protected
$endpoint
;
/**
* @var HttpException
*/
protected
$exception
;
/**
* Constructor
*
* @param Endpoint $endpoint
* @param HttpException $exception
*/
public
function
__construct
(
Endpoint
$endpoint
,
HttpException
$exception
)
{
$this
->
endpoint
=
$endpoint
;
$this
->
exception
=
$exception
;
}
/**
* @return Endpoint
*/
public
function
getEndpoint
()
{
return
$this
->
endpoint
;
}
/**
* @return HttpException
*/
public
function
getException
()
{
return
$this
->
exception
;
}
}
library/Solarium/Plugin/Loadbalancer/Event/Events.php
0 → 100644
View file @
9a0a166f
<?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\Plugin\Loadbalancer\Event
;
/**
* Event definitions
*/
class
Events
{
/**
* This event is called after and endpoint has failed.
*
* Gets the endpoint and the HttpException as params
*
* @var string
*/
const
ENDPOINT_FAILURE
=
'solarium.loadbalancer.endpointFailure'
;
}
library/Solarium/Plugin/Loadbalancer/Loadbalancer.php
View file @
9a0a166f
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
* @namespace
* @namespace
*/
*/
namespace
Solarium\Plugin\Loadbalancer
;
namespace
Solarium\Plugin\Loadbalancer
;
use
Solarium\Core\Plugin
;
use
Solarium\Core\Plugin
\Plugin
;
use
Solarium\Core\Client\Client
;
use
Solarium\Core\Client\Client
;
use
Solarium\Core\Client\Endpoint
;
use
Solarium\Core\Client\Endpoint
;
use
Solarium\Core\Query\Query
;
use
Solarium\Core\Query\Query
;
...
@@ -47,6 +47,11 @@ use Solarium\Exception\InvalidArgumentException;
...
@@ -47,6 +47,11 @@ use Solarium\Exception\InvalidArgumentException;
use
Solarium\Exception\OutOfBoundsException
;
use
Solarium\Exception\OutOfBoundsException
;
use
Solarium\Exception\RuntimeException
;
use
Solarium\Exception\RuntimeException
;
use
Solarium\Exception\HttpException
;
use
Solarium\Exception\HttpException
;
use
Solarium\Plugin\Loadbalancer\Event\Events
;
use
Solarium\Plugin\Loadbalancer\Event\EndpointFailure
as
EndpointFailureEvent
;
use
Solarium\Core\Event\Events
as
CoreEvents
;
use
Solarium\Core\Event\PreCreateRequest
as
PreCreateRequestEvent
;
use
Solarium\Core\Event\PreExecuteRequest
as
PreExecuteRequestEvent
;
/**
/**
* Loadbalancer plugin
* Loadbalancer plugin
...
@@ -159,6 +164,20 @@ class Loadbalancer extends Plugin
...
@@ -159,6 +164,20 @@ class Loadbalancer extends Plugin
}
}
}
}
/**
* Plugin init function
*
* Register event listeners
*
* @return void
*/
protected
function
initPluginType
()
{
$dispatcher
=
$this
->
client
->
getEventDispatcher
();
$dispatcher
->
addListener
(
CoreEvents
::
PRE_EXECUTE_REQUEST
,
array
(
$this
,
'preExecuteRequest'
));
$dispatcher
->
addListener
(
CoreEvents
::
PRE_CREATE_REQUEST
,
array
(
$this
,
'preCreateRequest'
));
}
/**
/**
* Set failover enabled option
* Set failover enabled option
*
*
...
@@ -426,21 +445,20 @@ class Loadbalancer extends Plugin
...
@@ -426,21 +445,20 @@ class Loadbalancer extends Plugin
/**
/**
* Event hook to capture querytype
* Event hook to capture querytype
*
*
* @param
Query $query
* @param
PreCreateRequestEvent $event
* @return void
* @return void
*/
*/
public
function
preCreateRequest
(
$query
)
public
function
preCreateRequest
(
PreCreateRequestEvent
$event
)
{
{
$this
->
queryType
=
$
query
->
getType
();
$this
->
queryType
=
$
event
->
getQuery
()
->
getType
();
}
}
/**
/**
* Event hook to adjust client settings just before query execution
* Event hook to adjust client settings just before query execution
*
*
* @param Request $request
* @param PreExecuteRequestEvent $event
* @return Response
*/
*/
public
function
preExecuteRequest
(
$reques
t
)
public
function
preExecuteRequest
(
PreExecuteRequestEvent
$even
t
)
{
{
$adapter
=
$this
->
client
->
getAdapter
();
$adapter
=
$this
->
client
->
getAdapter
();
...
@@ -451,14 +469,16 @@ class Loadbalancer extends Plugin
...
@@ -451,14 +469,16 @@ class Loadbalancer extends Plugin
// check querytype: is loadbalancing allowed?
// check querytype: is loadbalancing allowed?
if
(
!
array_key_exists
(
$this
->
queryType
,
$this
->
blockedQueryTypes
))
{
if
(
!
array_key_exists
(
$this
->
queryType
,
$this
->
blockedQueryTypes
))
{
return
$this
->
getLoadbalancedResponse
(
$request
);
$response
=
$this
->
getLoadbalancedResponse
(
$event
->
getRequest
()
);
}
else
{
}
else
{
$endpoint
=
$this
->
client
->
getEndpoint
(
$this
->
defaultEndpoint
);
$endpoint
=
$this
->
client
->
getEndpoint
(
$this
->
defaultEndpoint
);
$this
->
lastEndpoint
=
null
;
$this
->
lastEndpoint
=
null
;
// execute request and return result
// execute request and return result
return
$adapter
->
execute
(
$request
,
$endpoint
);
$response
=
$adapter
->
execute
(
$event
->
getRequest
()
,
$endpoint
);
}
}
$event
->
setResponse
(
$response
);
}
}
/**
/**
...
@@ -481,7 +501,10 @@ class Loadbalancer extends Plugin
...
@@ -481,7 +501,10 @@ class Loadbalancer extends Plugin
}
catch
(
HttpException
$e
)
{
}
catch
(
HttpException
$e
)
{
// ignore HTTP errors and try again
// ignore HTTP errors and try again
// but do issue an event for things like logging
// but do issue an event for things like logging
$this
->
client
->
triggerEvent
(
'LoadbalancerEndpointFail'
,
array
(
$endpoint
->
getOptions
(),
$e
));
$this
->
client
->
getEventDispatcher
()
->
dispatch
(
Events
::
ENDPOINT_FAILURE
,
new
EndpointFailureEvent
(
$endpoint
,
$e
)
);
}
}
}
}
...
...
library/Solarium/Plugin/ParallelExecution/Event/Events.php
0 → 100644
View file @
9a0a166f
<?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\Plugin\ParallelExecution\Event
;
/**
* Event definitions
*/
class
Events
{
/**
* This event is called just before parallel HTTP request execution, but after init work.
* Intented for timing use only, there are no params.
*
* @var string
*/
const
EXECUTE_START
=
'solarium.parallelExecution.executeStart'
;
/**
* This event is called just after parallel HTTP request execution, before further result handling.
* Intented for timing use only, there are no params.
*
* @var string
*/
const
EXECUTE_END
=
'solarium.parallelExecution.executeEnd'
;
}
library/Solarium/Plugin/ParallelExecution/Event/ExecuteEnd.php
0 → 100644
View file @
9a0a166f
<?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\Plugin\ParallelExecution\Event
;
use
Symfony\Component\EventDispatcher\Event
;
/**
* ExecuteEnd event, see Events for details
*/
class
ExecuteEnd
extends
Event
{
}
library/Solarium/Plugin/ParallelExecution/Event/ExecuteStart.php
0 → 100644
View file @
9a0a166f
<?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\Plugin\ParallelExecution\Event
;
use
Symfony\Component\EventDispatcher\Event
;
use
Solarium\QueryType\Update\Result
;
/**
* ExecuteStart event, see Events for details
*/
class
ExecuteStart
extends
Event
{
}
library/Solarium/Plugin/ParallelExecution.php
→
library/Solarium/Plugin/ParallelExecution
/ParallelExecution
.php
View file @
9a0a166f
...
@@ -36,11 +36,15 @@
...
@@ -36,11 +36,15 @@
/**
/**
* @namespace
* @namespace
*/
*/
namespace
Solarium\Plugin
;
namespace
Solarium\Plugin\ParallelExecution
;
use
Solarium\Core\Plugin
;
use
Solarium\Core\Plugin\Plugin
;
use
Solarium\Core\Client\HttpException
;
use
Solarium\Core\Client\Endpoint
;
use
Solarium\Exception\HttpException
;
use
Solarium\Core\Client\Client
;
use
Solarium\Core\Client\Client
;
use
Solarium\Core\Query\Query
;
use
Solarium\Core\Query\Query
;
use
Solarium\Plugin\ParallelExecution\Event\Events
;
use
Solarium\Plugin\ParallelExecution\Event\ExecuteStart
as
ExecuteStartEvent
;
use
Solarium\Plugin\ParallelExecution\Event\ExecuteEnd
as
ExecuteEndEvent
;
/**
/**
* ParallelExecution plugin
* ParallelExecution plugin
...
@@ -150,7 +154,7 @@ class ParallelExecution extends Plugin
...
@@ -150,7 +154,7 @@ class ParallelExecution extends Plugin
}
}
// executing multihandle (all requests)
// executing multihandle (all requests)
$this
->
client
->
triggerEvent
(
'ParallelExecutionStart'
);
$this
->
client
->
getEventDispatcher
()
->
dispatch
(
Events
::
EXECUTE_START
,
new
ExecuteStartEvent
()
);
do
{
do
{
$mrc
=
curl_multi_exec
(
$multiHandle
,
$active
);
$mrc
=
curl_multi_exec
(
$multiHandle
,
$active
);
...
@@ -165,7 +169,7 @@ class ParallelExecution extends Plugin
...
@@ -165,7 +169,7 @@ class ParallelExecution extends Plugin
}
}
}
}
$this
->
client
->
triggerEvent
(
'ParallelExecutionEnd'
);
$this
->
client
->
getEventDispatcher
()
->
dispatch
(
Events
::
EXECUTE_END
,
new
ExecuteEndEvent
()
);
// get the results
// get the results
$results
=
array
();
$results
=
array
();
...
...
library/Solarium/Plugin/PostBigRequest.php
View file @
9a0a166f
...
@@ -38,9 +38,10 @@
...
@@ -38,9 +38,10 @@
*/
*/
namespace
Solarium\Plugin
;
namespace
Solarium\Plugin
;
use
Solarium\Client
;
use
Solarium\Client
;
use
Solarium\Core\Plugin
;
use
Solarium\Core\Plugin\Plugin
;
use
Solarium\Core\Query\Query
;
use
Solarium\Core\Client\Request
;
use
Solarium\Core\Client\Request
;
use
Solarium\Core\Event\Events
;
use
Solarium\Core\Event\PostCreateRequest
as
PostCreateRequestEvent
;
/**
/**
* PostBigRequest plugin
* PostBigRequest plugin
...
@@ -64,6 +65,19 @@ class PostBigRequest extends Plugin
...
@@ -64,6 +65,19 @@ class PostBigRequest extends Plugin
'maxquerystringlength'
=>
1024
,
'maxquerystringlength'
=>
1024
,
);
);
/**
* Plugin init function
*
* Register event listeners
*
* @return void
*/
protected
function
initPluginType
()
{
$dispatcher
=
$this
->
client
->
getEventDispatcher
();
$dispatcher
->
addListener
(
Events
::
POST_CREATE_REQUEST
,
array
(
$this
,
'postCreateRequest'
));
}
/**
/**
* Set maxquerystringlength enabled option
* Set maxquerystringlength enabled option
*
*
...
@@ -88,12 +102,12 @@ class PostBigRequest extends Plugin
...
@@ -88,12 +102,12 @@ class PostBigRequest extends Plugin
/**
/**
* Event hook to adjust client settings just before query execution
* Event hook to adjust client settings just before query execution
*
*
* @param Query $query
* @param PostCreateRequestEvent $event
* @param Request $request
* @return void
* @return void
*/
*/
public
function
postCreateRequest
(
$
query
,
$reques
t
)
public
function
postCreateRequest
(
$
even
t
)
{
{
$request
=
$event
->
getRequest
();
$queryString
=
$request
->
getQueryString
();
$queryString
=
$request
->
getQueryString
();
if
(
$request
->
getMethod
()
==
Request
::
METHOD_GET
&&
if
(
$request
->
getMethod
()
==
Request
::
METHOD_GET
&&
strlen
(
$queryString
)
>
$this
->
getMaxQueryStringLength
())
{
strlen
(
$queryString
)
>
$this
->
getMaxQueryStringLength
())
{
...
...
library/Solarium/Plugin/PrefetchIterator.php
View file @
9a0a166f
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
*/
*/
namespace
Solarium\Plugin
;
namespace
Solarium\Plugin
;
use
Solarium\Client
;
use
Solarium\Client
;
use
Solarium\Core\Plugin
;
use
Solarium\Core\Plugin
\Plugin
;
use
Solarium\QueryType\Select\Query\Query
as
SelectQuery
;
use
Solarium\QueryType\Select\Query\Query
as
SelectQuery
;
use
Solarium\QueryType\Select\Result\Result
as
SelectResult
;
use
Solarium\QueryType\Select\Result\Result
as
SelectResult
;
...
...
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