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
d30aa65b
Commit
d30aa65b
authored
Mar 21, 2013
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '
d51c98e8
' into develop
parents
10ffdc8c
d51c98e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
2 deletions
+32
-2
library/Solarium/Plugin/BufferedAdd/BufferedAdd.php
library/Solarium/Plugin/BufferedAdd/BufferedAdd.php
+32
-2
No files found.
library/Solarium/Plugin/BufferedAdd/BufferedAdd.php
View file @
d30aa65b
...
...
@@ -80,6 +80,13 @@ class BufferedAdd extends Plugin
* @var DocumentInterface[]
*/
protected
$buffer
=
array
();
/**
* End point to execute updates against.
*
* @var string
*/
protected
$endpoint
;
/**
* Plugin init function
...
...
@@ -93,6 +100,29 @@ class BufferedAdd extends Plugin
{
$this
->
updateQuery
=
$this
->
client
->
createUpdate
();
}
/**
* Set the endpoint for the documents
*
* @param string $endpoint The endpoint to set
*
* @return self
*/
public
function
setEndpoint
(
$endpoint
)
{
$this
->
endpoint
=
$endpoint
;
return
$this
;
}
/**
* Return the endpoint
*
* @return string
*/
public
function
getEndPoint
()
{
return
$this
->
endpoint
;
}
/**
* Set buffer size option
...
...
@@ -208,7 +238,7 @@ class BufferedAdd extends Plugin
$this
->
client
->
getEventDispatcher
()
->
dispatch
(
Events
::
PRE_FLUSH
,
$event
);
$this
->
updateQuery
->
addDocuments
(
$event
->
getBuffer
(),
$event
->
getOverwrite
(),
$event
->
getCommitWithin
());
$result
=
$this
->
client
->
update
(
$this
->
updateQuery
);
$result
=
$this
->
client
->
update
(
$this
->
updateQuery
,
$this
->
getEndpoint
()
);
$this
->
clear
();
$event
=
new
PostFlushEvent
(
$result
);
...
...
@@ -235,7 +265,7 @@ class BufferedAdd extends Plugin
$this
->
updateQuery
->
addDocuments
(
$this
->
buffer
,
$event
->
getOverwrite
());
$this
->
updateQuery
->
addCommit
(
$event
->
getSoftCommit
(),
$event
->
getWaitSearcher
(),
$event
->
getExpungeDeletes
());
$result
=
$this
->
client
->
update
(
$this
->
updateQuery
);
$result
=
$this
->
client
->
update
(
$this
->
updateQuery
,
$this
->
getEndpoint
()
);
$this
->
clear
();
$event
=
new
PostCommitEvent
(
$result
);
...
...
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