mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 14:05:29 +02:00
3d18903552
Solr::configure_server now takes "version" as one of the keys in the option array, and behaves slightly differently depending on whether that version is 3 or 4, to provide support for both Solr versions. The Solr extras and templates have also moved, so that different versions can be provided for the two different Solr versions.
26 lines
799 B
PHP
26 lines
799 B
PHP
<?php
|
|
|
|
class Solr4Service_Core extends SolrService_Core {
|
|
|
|
/**
|
|
* Replace underlying commit function to remove waitFlush in 4.0+, since it's been deprecated and 4.4 throws errors
|
|
* if you pass it
|
|
*/
|
|
public function commit($expungeDeletes = false, $waitFlush = null, $waitSearcher = true, $timeout = 3600) {
|
|
if ($waitFlush) {
|
|
user_error('waitFlush must be false when using Solr 4.0+' . E_USER_ERROR);
|
|
}
|
|
|
|
$expungeValue = $expungeDeletes ? 'true' : 'false';
|
|
$searcherValue = $waitSearcher ? 'true' : 'false';
|
|
|
|
$rawPost = '<commit expungeDeletes="' . $expungeValue . '" waitSearcher="' . $searcherValue . '" />';
|
|
return $this->_sendRawPost($this->_updateUrl, $rawPost, $timeout);
|
|
}
|
|
}
|
|
|
|
class Solr4Service extends SolrService {
|
|
private static $core_class = 'Solr4Service_Core';
|
|
}
|
|
|