Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into issue-626-managed…
Browse files Browse the repository at this point in the history
…-resources
  • Loading branch information
jsteggink committed Nov 5, 2018
2 parents 5be312f + e7a9f92 commit b8fe6ab
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 7 deletions.
24 changes: 17 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,44 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [master]
### Added

### Changed

### Deprecated

### Removed

### Fixed

### Security


## [4.2.0-beta.1]
### Added
- Basic support for PUT requests in the HttpAdapter layer
- Support for managed resources
- Core Admin Queries
- Endpoint::getServerUri
- Endpoint::getCoreBaseUri
- Expression::indent
- BufferedAdd::setCommitWithin
- BufferedAdd::setOverwrite
- Set erroneous expression on StreamException
- Managed resources, stopwords and synonyms query types

### Changed

### Deprecated
- Endpoint::getBaseUri is deprecated. Please use getServerUri or getCoreBaseUri now.

### Removed

### Fixed
- Allow multiple Field Facets for the same field by dynamically using local facet params if required

### Security


## [4.1.0]
### Added
- Method AbstractQuery::removeParam() to remove a custom parameter or to reset a required but modified parameter
- Basic support for DELETE requests in the HttpAdapter layer
- Introduced an AdapterHelper class to start unifying implementations across all HTTP adapters


### Changed
- To unify the file extraction across all HTTP Adapters, the filename is now always reduced to its basepath

Expand Down
47 changes: 47 additions & 0 deletions src/Plugin/BufferedAdd/BufferedAdd.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,50 @@ public function getBufferSize()
return $this->getOption('buffersize');
}

/**
* Set commitWithin time option.
*
* @param int $time
*
* @return self
*/
public function setCommitWithin($time)
{
return $this->setOption('commitwithin', $time);
}

/**
* Get commitWithin time option value.
*
* @return int
*/
public function getCommitWithin()
{
return $this->getOption('commitwithin');
}

/**
* Set overwrite boolean option.
*
* @param bool $value
*
* @return self
*/
public function setOverwrite($value)
{
return $this->setOption('overwrite', $value);
}

/**
* Get overwrite boolean option value.
*
* @return bool
*/
public function getOverwrite()
{
return $this->getOption('overwrite');
}

/**
* Create a document object instance and add it to the buffer.
*
Expand Down Expand Up @@ -181,6 +225,9 @@ public function flush($overwrite = null, $commitWithin = null)
return false;
}

$overwrite = is_null($overwrite) ? $this->getOverwrite() : $overwrite;
$commitWithin = is_null($commitWithin) ? $this->getCommitWithin() : $commitWithin;

$event = new PreFlushEvent($this->buffer, $overwrite, $commitWithin);
$this->client->getEventDispatcher()->dispatch(Events::PRE_FLUSH, $event);

Expand Down
12 changes: 12 additions & 0 deletions tests/Plugin/BufferedAdd/BufferedAddTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ public function testSetAndGetBufferSize()
$this->assertSame(500, $this->plugin->getBufferSize());
}

public function testSetAndGetOverwrite()
{
$this->plugin->setOverwrite(true);
$this->assertTrue($this->plugin->getOverwrite());
}

public function testSetAndGetCommitWithin()
{
$this->plugin->setCommitWithin(500);
$this->assertSame(500, $this->plugin->getCommitWithin());
}

public function testAddDocument()
{
$doc = new Document();
Expand Down

0 comments on commit b8fe6ab

Please sign in to comment.