mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 14:05:29 +02:00
Merge pull request #243 from creative-commoners/pulls/3.4/phpdocs
Update namespace references in broken PHP docs and simplify condition logic
This commit is contained in:
commit
46c7477ad5
@ -9,6 +9,8 @@ use SilverStripe\Core\Manifest\ModuleLoader;
|
|||||||
use SilverStripe\FullTextSearch\Search\FullTextSearch;
|
use SilverStripe\FullTextSearch\Search\FullTextSearch;
|
||||||
use SilverStripe\FullTextSearch\Solr\Services\Solr4Service;
|
use SilverStripe\FullTextSearch\Solr\Services\Solr4Service;
|
||||||
use SilverStripe\FullTextSearch\Solr\Services\Solr3Service;
|
use SilverStripe\FullTextSearch\Solr\Services\Solr3Service;
|
||||||
|
use SilverStripe\FullTextSearch\Solr\Services\SolrService;
|
||||||
|
use SilverStripe\FullTextSearch\Solr\Services\SolrService_Core;
|
||||||
|
|
||||||
class Solr
|
class Solr
|
||||||
{
|
{
|
||||||
@ -112,14 +114,14 @@ class Solr
|
|||||||
|
|
||||||
/** @var SolrService | null - The instance of SolrService for core management */
|
/** @var SolrService | null - The instance of SolrService for core management */
|
||||||
protected static $service_singleton = null;
|
protected static $service_singleton = null;
|
||||||
/** @var [SolrService_Core] - The instances of SolrService_Core for each core */
|
/** @var SolrService_Core[] - The instances of SolrService_Core for each core */
|
||||||
protected static $service_core_singletons = array();
|
protected static $service_core_singletons = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a SolrService
|
* Get a SolrService
|
||||||
*
|
*
|
||||||
* @param string $core Optional name of index class
|
* @param string $core Optional name of index class
|
||||||
* @return SolrService_Core
|
* @return SolrService|SolrService_Core
|
||||||
*/
|
*/
|
||||||
public static function service($core = null)
|
public static function service($core = null)
|
||||||
{
|
{
|
||||||
@ -142,9 +144,8 @@ class Solr
|
|||||||
}
|
}
|
||||||
|
|
||||||
return self::$service_core_singletons[$core];
|
return self::$service_core_singletons[$core];
|
||||||
} else {
|
|
||||||
return self::$service_singleton;
|
|
||||||
}
|
}
|
||||||
|
return self::$service_singleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function get_indexes()
|
public static function get_indexes()
|
||||||
|
@ -12,6 +12,7 @@ use SilverStripe\FullTextSearch\Search\Queries\SearchQuery;
|
|||||||
use SilverStripe\FullTextSearch\Search\Queries\SearchQuery_Range;
|
use SilverStripe\FullTextSearch\Search\Queries\SearchQuery_Range;
|
||||||
use SilverStripe\FullTextSearch\Search\Variants\SearchVariant;
|
use SilverStripe\FullTextSearch\Search\Variants\SearchVariant;
|
||||||
use SilverStripe\FullTextSearch\Search\SearchIntrospection;
|
use SilverStripe\FullTextSearch\Search\SearchIntrospection;
|
||||||
|
use SilverStripe\FullTextSearch\Solr\Stores\SolrConfigStore;
|
||||||
use SilverStripe\ORM\ArrayList;
|
use SilverStripe\ORM\ArrayList;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\FieldType\DBField;
|
use SilverStripe\ORM\FieldType\DBField;
|
||||||
|
@ -3,6 +3,7 @@ namespace SilverStripe\FullTextSearch\Solr\Tasks;
|
|||||||
|
|
||||||
use Monolog\Handler\StreamHandler;
|
use Monolog\Handler\StreamHandler;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
use SilverStripe\Control\HTTPRequest;
|
||||||
use SilverStripe\Core\Injector\Injector;
|
use SilverStripe\Core\Injector\Injector;
|
||||||
use SilverStripe\Dev\BuildTask;
|
use SilverStripe\Dev\BuildTask;
|
||||||
use SilverStripe\FullTextSearch\Utils\Logging\SearchLogFactory;
|
use SilverStripe\FullTextSearch\Utils\Logging\SearchLogFactory;
|
||||||
@ -52,7 +53,7 @@ class Solr_BuildTask extends BuildTask
|
|||||||
/**
|
/**
|
||||||
* Setup task
|
* Setup task
|
||||||
*
|
*
|
||||||
* @param SS_HTTPReqest $request
|
* @param HTTPRequest $request
|
||||||
*/
|
*/
|
||||||
public function run($request)
|
public function run($request)
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,7 @@ namespace SilverStripe\FullTextSearch\Solr\Tasks;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use SilverStripe\Core\ClassInfo;
|
use SilverStripe\Core\ClassInfo;
|
||||||
use SilverStripe\FullTextSearch\Solr\Solr;
|
use SilverStripe\FullTextSearch\Solr\Solr;
|
||||||
|
use SilverStripe\FullTextSearch\Solr\SolrIndex;
|
||||||
use SilverStripe\FullTextSearch\Solr\Stores\SolrConfigStore_File;
|
use SilverStripe\FullTextSearch\Solr\Stores\SolrConfigStore_File;
|
||||||
use SilverStripe\FullTextSearch\Solr\Stores\SolrConfigStore_WebDAV;
|
use SilverStripe\FullTextSearch\Solr\Stores\SolrConfigStore_WebDAV;
|
||||||
use SilverStripe\FullTextSearch\Solr\Stores\SolrConfigStore;
|
use SilverStripe\FullTextSearch\Solr\Stores\SolrConfigStore;
|
||||||
@ -50,29 +51,30 @@ class Solr_Configure extends Solr_BuildTask
|
|||||||
protected function updateIndex($instance, $store)
|
protected function updateIndex($instance, $store)
|
||||||
{
|
{
|
||||||
$index = $instance->getIndexName();
|
$index = $instance->getIndexName();
|
||||||
$this->getLogger()->addInfo("Configuring $index.");
|
$this->getLogger()->info("Configuring $index.");
|
||||||
|
|
||||||
// Upload the config files for this index
|
// Upload the config files for this index
|
||||||
$this->getLogger()->addInfo("Uploading configuration ...");
|
$this->getLogger()->info("Uploading configuration ...");
|
||||||
$instance->uploadConfig($store);
|
$instance->uploadConfig($store);
|
||||||
|
|
||||||
// Then tell Solr to use those config files
|
// Then tell Solr to use those config files
|
||||||
$service = Solr::service();
|
$service = Solr::service();
|
||||||
if ($service->coreIsActive($index)) {
|
if ($service->coreIsActive($index)) {
|
||||||
$this->getLogger()->addInfo("Reloading core ...");
|
$this->getLogger()->info("Reloading core ...");
|
||||||
$service->coreReload($index);
|
$service->coreReload($index);
|
||||||
} else {
|
} else {
|
||||||
$this->getLogger()->addInfo("Creating core ...");
|
$this->getLogger()->info("Creating core ...");
|
||||||
$service->coreCreate($index, $store->instanceDir($index));
|
$service->coreCreate($index, $store->instanceDir($index));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->getLogger()->addInfo("Done");
|
$this->getLogger()->info("Done");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get config store
|
* Get config store
|
||||||
*
|
*
|
||||||
* @return SolrConfigStore
|
* @return SolrConfigStore
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function getSolrConfigStore()
|
protected function getSolrConfigStore()
|
||||||
{
|
{
|
||||||
@ -85,14 +87,15 @@ class Solr_Configure extends Solr_BuildTask
|
|||||||
// Find the IndexStore handler, which will handle uploading config files to Solr
|
// Find the IndexStore handler, which will handle uploading config files to Solr
|
||||||
$mode = $indexstore['mode'];
|
$mode = $indexstore['mode'];
|
||||||
|
|
||||||
if ($mode == 'file') {
|
if ($mode === 'file') {
|
||||||
return new SolrConfigStore_File($indexstore);
|
return new SolrConfigStore_File($indexstore);
|
||||||
} elseif ($mode == 'webdav') {
|
}
|
||||||
|
if ($mode === 'webdav') {
|
||||||
return new SolrConfigStore_WebDAV($indexstore);
|
return new SolrConfigStore_WebDAV($indexstore);
|
||||||
} elseif (ClassInfo::exists($mode) && ClassInfo::classImplements($mode, SolrConfigStore::class)) {
|
}
|
||||||
|
if (ClassInfo::exists($mode) && ClassInfo::classImplements($mode, SolrConfigStore::class)) {
|
||||||
return new $mode($indexstore);
|
return new $mode($indexstore);
|
||||||
} else {
|
}
|
||||||
user_error('Unknown Solr index mode ' . $indexstore['mode'], E_USER_ERROR);
|
user_error('Unknown Solr index mode ' . $indexstore['mode'], E_USER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace SilverStripe\FullTextSearch\Utils\Logging;
|
namespace SilverStripe\FullTextSearch\Utils\Logging;
|
||||||
|
|
||||||
use Psr\Log;
|
use Psr\Log;
|
||||||
|
use Symbiote\QueuedJobs\Services\QueuedJob;
|
||||||
|
|
||||||
interface SearchLogFactory
|
interface SearchLogFactory
|
||||||
{
|
{
|
||||||
@ -10,7 +11,7 @@ interface SearchLogFactory
|
|||||||
* Make a logger for a queuedjob
|
* Make a logger for a queuedjob
|
||||||
*
|
*
|
||||||
* @param QueuedJob $job
|
* @param QueuedJob $job
|
||||||
* @return Log
|
* @return Log\LoggerInterface
|
||||||
*/
|
*/
|
||||||
public function getQueuedJobLogger($job);
|
public function getQueuedJobLogger($job);
|
||||||
|
|
||||||
@ -19,7 +20,7 @@ interface SearchLogFactory
|
|||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param bool $verbose
|
* @param bool $verbose
|
||||||
* @return Log
|
* @return Log\LoggerInterface
|
||||||
*/
|
*/
|
||||||
public function getOutputLogger($name, $verbose);
|
public function getOutputLogger($name, $verbose);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user