Commit d30aa65b authored by Bas de Nooijer's avatar Bas de Nooijer

Merge commit 'd51c98e8' into develop

parents 10ffdc8c d51c98e8
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment