mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 14:05:29 +02:00
Explicit namespace definition on YAML files
This commit is contained in:
parent
da0a217aa0
commit
8228c762c9
@ -1,4 +1,4 @@
|
||||
Injector:
|
||||
SilverStripe\Core\Injector\Injector:
|
||||
RequestProcessor:
|
||||
properties:
|
||||
filters:
|
||||
|
@ -1,3 +1,3 @@
|
||||
DataObject:
|
||||
SilverStripe\ORM\DataObject\DataObject:
|
||||
extensions:
|
||||
- 'SearchUpdater_ObjectHandler'
|
||||
- 'SilverStripe\FullTextSearch\Search\Updaters\SearchUpdater_ObjectHandler'
|
||||
|
@ -1,13 +1,13 @@
|
||||
---
|
||||
Name: defaultprocessor
|
||||
---
|
||||
Injector:
|
||||
SearchUpdateProcessor:
|
||||
class: SearchUpdateImmediateProcessor
|
||||
SolrReindexHandler:
|
||||
class: SolrReindexImmediateHandler
|
||||
SearchLogFactory:
|
||||
class: 'MonologFactory'
|
||||
SilverStripe\Core\Injector\Injector:
|
||||
SilverStripe\FullTextSearch\Search\Processors\SearchUpdateProcessor:
|
||||
class: SilverStripe\FullTextSearch\Search\Processors\SearchUpdateImmediateProcessor
|
||||
SilverStripe\FullTextSearch\Solr\Reindex\Handlers\SolrReindexHandler:
|
||||
class: SilverStripe\FullTextSearch\Solr\Reindex\Handlers\SolrReindexImmediateHandler
|
||||
SilverStripe\FullTextSearch\Utils\Logging\SearchLogFactory:
|
||||
class: 'SilverStripe\FullTextSearch\Utils\Logging\MonologFactory'
|
||||
---
|
||||
Name: messagequeueprocessor
|
||||
Only:
|
||||
@ -15,11 +15,11 @@ Only:
|
||||
Except:
|
||||
Environment: 'dev'
|
||||
---
|
||||
Injector:
|
||||
SearchUpdateProcessor:
|
||||
class: SearchUpdateMessageQueueProcessor
|
||||
SolrReindexHandler:
|
||||
class: SolrReindexMessageHandler
|
||||
SilverStripe\Core\Injector\Injector:
|
||||
SilverStripe\FullTextSearch\Search\Processors\SearchUpdateProcessor:
|
||||
class: SilverStripe\FullTextSearch\Search\Processors\SearchUpdateMessageQueueProcessor
|
||||
SilverStripe\FullTextSearch\Solr\Reindex\Handlers\SolrReindexHandler:
|
||||
class: SilverStripe\FullTextSearch\Solr\Reindex\Handlers\SolrReindexMessageHandler
|
||||
---
|
||||
Name: queuedjobprocessor
|
||||
Only:
|
||||
@ -27,8 +27,8 @@ Only:
|
||||
Except:
|
||||
Environment: 'dev'
|
||||
---
|
||||
Injector:
|
||||
SearchUpdateProcessor:
|
||||
class: SearchUpdateQueuedJobProcessor
|
||||
SolrReindexHandler:
|
||||
class: SolrReindexQueuedHandler
|
||||
SilverStripe\Core\Injector\Injector:
|
||||
SilverStripe\FullTextSearch\Search\Processors\SearchUpdateProcessor:
|
||||
class: SilverStripe\FullTextSearch\Search\Processors\SearchUpdateQueuedJobProcessor
|
||||
SilverStripe\FullTextSearch\Solr\Reindex\Handlers\SolrReindexHandler:
|
||||
class: SilverStripe\FullTextSearch\Solr\Reindex\Handlers\SolrReindexQueuedHandler
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace SilverStripe\FullTextSearch\Search;
|
||||
|
||||
use ReflectionClass;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Core\ClassInfo;
|
||||
/**
|
||||
@ -41,7 +42,7 @@ class FullTextSearch
|
||||
if (self::$all_indexes === null) {
|
||||
// Get declared indexes, or otherwise default to all subclasses of SearchIndex
|
||||
$classes = Config::inst()->get(__CLASS__, 'indexes')
|
||||
?: ClassInfo::subclassesFor('SearchIndex');
|
||||
?: ClassInfo::subclassesFor('SilverStripe\FullTextSearch\Solr\SearchIndex');
|
||||
|
||||
$hidden = array();
|
||||
$candidates = array();
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace SilverStripe\FullTextSearch\Search\Indexes;
|
||||
|
||||
use Exception;
|
||||
use InvalidArgumentException;
|
||||
use SilverStripe\View\ViewableData;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\ORM\DataObjectSchema;
|
||||
@ -303,7 +305,7 @@ abstract class SearchIndex extends ViewableData
|
||||
$type = $match[1];
|
||||
}
|
||||
list($type, $args) = Object::parse_class_spec($type);
|
||||
if (is_subclass_of($type, 'StringField')) {
|
||||
if (is_subclass_of($type, 'SilverStripe\ORM\FieldType\DBString')) {
|
||||
$this->addFulltextField($field);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,12 @@
|
||||
|
||||
namespace SilverStripe\FullTextSearch\Search\Updaters;
|
||||
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\FullTextSearch\Search\FullTextSearch;
|
||||
use SilverStripe\FullTextSearch\Search\SearchIntrospection;
|
||||
use SilverStripe\FullTextSearch\Search\Variants\SearchVariant;
|
||||
use SilverStripe\ORM\DB;
|
||||
use SilverStripe\Core\ClassInfo;
|
||||
/**
|
||||
* This class is responsible for capturing changes to DataObjects and triggering index updates of the resulting dirty index
|
||||
* items.
|
||||
|
@ -3,6 +3,7 @@ namespace SilverStripe\FullTextSearch\Solr;
|
||||
|
||||
use SilverStripe\Control\Director;
|
||||
use SilverStripe\Core\Object;
|
||||
use SilverStripe\FullTextSearch\Search\FullTextSearch;
|
||||
|
||||
class Solr
|
||||
{
|
||||
@ -136,7 +137,7 @@ class Solr
|
||||
|
||||
public static function get_indexes()
|
||||
{
|
||||
return FullTextSearch::get_indexes('SolrIndex');
|
||||
return FullTextSearch::get_indexes('SilverStripe\FullTextSearch\Solr\SolrIndex');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace SilverStripe\FullTextSearch\Solr\Reindex\Handlers;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use SilverStripe\FullTextSearch\Search\Variants\SearchVariant;
|
||||
use SilverStripe\FullTextSearch\Solr\Solr;
|
||||
use SilverStripe\FullTextSearch\Solr\SolrIndex;
|
||||
|
||||
|
@ -3,7 +3,10 @@
|
||||
namespace SilverStripe\FullTextSearch\Solr\Reindex\Handlers;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use SilverStripe\Control\Director;
|
||||
use SilverStripe\FullTextSearch\Solr\Solr;
|
||||
use SilverStripe\FullTextSearch\Solr\SolrIndex;
|
||||
use SilverStripe\ORM\DB;
|
||||
|
||||
/**
|
||||
* Invokes an immediate reindex
|
||||
|
@ -44,7 +44,7 @@ abstract class SolrReindexQueuedJobBase implements QueuedJob
|
||||
*/
|
||||
protected function getLoggerFactory()
|
||||
{
|
||||
return Injector::inst()->get('SearchLogFactory');
|
||||
return Injector::inst()->get('SilverStripe\FullTextSearch\Utils\Logging\SearchLogFactory');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -103,7 +103,7 @@ abstract class SolrReindexQueuedJobBase implements QueuedJob
|
||||
*/
|
||||
protected function getHandler()
|
||||
{
|
||||
return Injector::inst()->get('SolrReindexHandler');
|
||||
return Injector::inst()->get('SilverStripe\FullTextSearch\Solr\Reindex\Handlers\SolrReindexHandler');
|
||||
}
|
||||
|
||||
public function jobFinished()
|
||||
|
@ -3,5 +3,5 @@ namespace SilverStripe\FullTextSearch\Solr\Services;
|
||||
|
||||
class Solr3Service extends SolrService
|
||||
{
|
||||
private static $core_class = 'Solr3Service_Core';
|
||||
private static $core_class = 'SilverStripe\FullTextSearch\Solr\Services\Solr3Service';
|
||||
}
|
||||
|
@ -3,5 +3,5 @@ namespace SilverStripe\FullTextSearch\Solr\Services;
|
||||
|
||||
class Solr4Service extends SolrService
|
||||
{
|
||||
private static $core_class = 'Solr4Service_Core';
|
||||
private static $core_class = 'SilverStripe\FullTextSearch\Solr\Services\Solr4Service';
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ class Solr4Service_Core extends SolrService_Core
|
||||
|
||||
$rawPost = "<add overwrite=\"{$overwriteVal}\"{$commitWithinString}>";
|
||||
foreach ($documents as $document) {
|
||||
if ($document instanceof Apache_Solr_Document) {
|
||||
if ($document instanceof \Apache_Solr_Document) {
|
||||
$rawPost .= $this->_documentToXmlFragment($document);
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ Solr::include_client_api();
|
||||
*/
|
||||
class SolrService extends SolrService_Core
|
||||
{
|
||||
private static $core_class = 'SolrService_Core';
|
||||
private static $core_class = 'SilverStripe\FullTextSearch\Solr\Services\SolrService';
|
||||
|
||||
/**
|
||||
* Handle encoding the GET parameters and making the HTTP call to execute a core command
|
||||
|
@ -2,6 +2,10 @@
|
||||
|
||||
namespace SilverStripe\FullTextSearch\Solr\Stores;
|
||||
|
||||
use SilverStripe\FullTextSearch\Solr\Solr;
|
||||
use SilverStripe\FullTextSearch\Utils\WebDAV;
|
||||
|
||||
|
||||
/**
|
||||
* Class SolrConfigStore_WebDAV
|
||||
*
|
||||
|
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
namespace SilverStripe\FullTextSearch\Solr\Tasks;
|
||||
use SilverStripe\Core\Injector\Injector;
|
||||
use SilverStripe\Dev\BuildTask;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use SilverStripe\FullTextSearch\Utils\Logging\SearchLogFactory;
|
||||
/**
|
||||
* Abstract class for build tasks
|
||||
*/
|
||||
@ -22,7 +25,7 @@ class Solr_BuildTask extends BuildTask
|
||||
*/
|
||||
public function getLogger()
|
||||
{
|
||||
return Injector::inst()->get('Logger');
|
||||
return Injector::inst()->get('Psr\Log\LoggerInterface');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -40,7 +43,7 @@ class Solr_BuildTask extends BuildTask
|
||||
*/
|
||||
protected function getLoggerFactory()
|
||||
{
|
||||
// return Injector::inst()->get('SearchLogFactory');
|
||||
return Injector::inst()->get('SilverStripe\FullTextSearch\Utils\Logging\SearchLogFactory');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -55,9 +58,8 @@ class Solr_BuildTask extends BuildTask
|
||||
|
||||
// Set new logger
|
||||
$logger = $this
|
||||
->getLoggerFactory();
|
||||
//@todo: Cannot instantiate interface SearchLogFactory
|
||||
// ->getOutputLogger($name, $verbose);
|
||||
->getLoggerFactory()
|
||||
->getOutputLogger($name, $verbose);
|
||||
$this->setLogger($logger);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,11 @@
|
||||
<?php
|
||||
namespace SilverStripe\FullTextSearch\Solr\Tasks;
|
||||
use Exception;
|
||||
use SilverStripe\Core\ClassInfo;
|
||||
use SilverStripe\FullTextSearch\Solr\Solr;
|
||||
use SilverStripe\FullTextSearch\Solr\Stores\SolrConfigStore_File;
|
||||
use SilverStripe\FullTextSearch\Solr\Stores\SolrConfigStore_WebDAV;
|
||||
|
||||
class Solr_Configure extends Solr_BuildTask
|
||||
{
|
||||
protected $enabled = true;
|
||||
@ -72,7 +78,7 @@ class Solr_Configure extends Solr_BuildTask
|
||||
return new SolrConfigStore_File($indexstore);
|
||||
} elseif ($mode == 'webdav') {
|
||||
return new SolrConfigStore_WebDAV($indexstore);
|
||||
} elseif (ClassInfo::exists($mode) && ClassInfo::classImplements($mode, 'SolrConfigStore')) {
|
||||
} elseif (ClassInfo::exists($mode) && ClassInfo::classImplements($mode, 'SilverStripe\FullTextSearch\Solr\Stores\SolrConfigStore')) {
|
||||
return new $mode($indexstore);
|
||||
} else {
|
||||
user_error('Unknown Solr index mode '.$indexstore['mode'], E_USER_ERROR);
|
||||
|
@ -1,5 +1,12 @@
|
||||
<?php
|
||||
namespace SilverStripe\FullTextSearch\Solr\Tasks;
|
||||
|
||||
use ReflectionClass;
|
||||
use SilverStripe\Core\ClassInfo;
|
||||
use SilverStripe\Core\Injector\Injector;
|
||||
use SilverStripe\FullTextSearch\Search\Variants\SearchVariant;
|
||||
use SilverStripe\ORM\DataList;
|
||||
|
||||
/**
|
||||
* Task used for both initiating a new reindex, as well as for processing incremental batches
|
||||
* within a reindex.
|
||||
@ -34,9 +41,7 @@ class Solr_Reindex extends Solr_BuildTask
|
||||
*/
|
||||
protected function getHandler()
|
||||
{
|
||||
//@todo: this needs to determine the best class from a Factory implementation
|
||||
//@todo: it was 'SolrReindexHandler' but that doesn't work on 4.0
|
||||
return Injector::inst()->get('SolrReindexImmediateHandler');
|
||||
return Injector::inst()->get('SilverStripe\FullTextSearch\Solr\Reindex\Handlers\SolrReindexHandler');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -65,7 +70,7 @@ class Solr_Reindex extends Solr_BuildTask
|
||||
// this is for when index names do not match the class name (this can be done by overloading getIndexName() on
|
||||
// indexes
|
||||
if ($index && !ClassInfo::exists($index)) {
|
||||
foreach(ClassInfo::subclassesFor('SolrIndex') as $solrIndexClass) {
|
||||
foreach(ClassInfo::subclassesFor('SilverStripe\FullTextSearch\Solr\SolrIndex') as $solrIndexClass) {
|
||||
$reflection = new ReflectionClass($solrIndexClass);
|
||||
//skip over abstract classes
|
||||
if (!$reflection->isInstantiable()) {
|
||||
|
@ -4,6 +4,8 @@ use Monolog\Formatter\FormatterInterface;
|
||||
use Monolog\Formatter\LineFormatter;
|
||||
use Monolog\Handler\HandlerInterface;
|
||||
use Monolog\Logger;
|
||||
use SilverStripe\Core\Injector\Injector;
|
||||
use SilverStripe\Control\Director;
|
||||
|
||||
/**
|
||||
* Provides logging based on monolog
|
||||
|
@ -56,16 +56,16 @@ All possible parameters incl optional ones with example values:
|
||||
Solr::configure_server(array(
|
||||
'host' => 'localhost', // default: localhost | The host or IP Solr is listening on
|
||||
'port' => '8983', // default: 8983 | The port Solr is listening on
|
||||
'path' => '/solr' // default: /solr | The suburl the solr service is available on
|
||||
'version' => '4' // default: 4 | Solr server version - currently only 3 and 4 supported
|
||||
'service' => 'Solr4Service' // default: depends on version, Solr3Service for 3, Solr4Service for 4 | the class that provides actual communcation to the Solr server
|
||||
'extraspath' => BASE_PATH .'/fulltextsearch/conf/solr/4/extras/' // default: <basefolder>/fulltextsearch/conf/solr/{version}/extras/ | Absolute path to the folder containing templates which are used for generating the schema and field definitions.
|
||||
'templates' => BASE_PATH . '/fulltextsearch/conf/solr/4/templates/' // default: <basefolder>/fulltextsearch/conf/solr/{version}/templates/ | Absolute path to the configuration default files, e.g. solrconfig.xml
|
||||
'path' => '/solr', // default: /solr | The suburl the solr service is available on
|
||||
'version' => '4', // default: 4 | Solr server version - currently only 3 and 4 supported
|
||||
'service' => 'Solr4Service', // default: depends on version, Solr3Service for 3, Solr4Service for 4 | the class that provides actual communcation to the Solr server
|
||||
'extraspath' => BASE_PATH .'/fulltextsearch/conf/solr/4/extras/', // default: <basefolder>/fulltextsearch/conf/solr/{version}/extras/ | Absolute path to the folder containing templates which are used for generating the schema and field definitions.
|
||||
'templates' => BASE_PATH . '/fulltextsearch/conf/solr/4/templates/', // default: <basefolder>/fulltextsearch/conf/solr/{version}/templates/ | Absolute path to the configuration default files, e.g. solrconfig.xml
|
||||
'indexstore' => array(
|
||||
'mode' => 'file', // a classname which implements SolrConfigStore, or 'file' or 'webdav'
|
||||
'path' => BASE_PATH . '/.solr' // The (locally accessible) path to write the index configurations to OR The suburl on the solr host that is set up to accept index configurations via webdav
|
||||
'remotepath' => '/opt/solr/config' // default (file mode only): same as 'path' above | The path that the Solr server will read the index configurations from
|
||||
'auth' => 'solr:solr' // default: none | Webdav only - A username:password pair string to use to auth against the webdav server
|
||||
'path' => BASE_PATH . '/.solr', // The (locally accessible) path to write the index configurations to OR The suburl on the solr host that is set up to accept index configurations via webdav
|
||||
'remotepath' => '/opt/solr/config', // default (file mode only): same as 'path' above | The path that the Solr server will read the index configurations from
|
||||
'auth' => 'solr:solr', // default: none | Webdav only - A username:password pair string to use to auth against the webdav server
|
||||
'port' => '80' // default: same as solr port | The port for WebDAV if different from the Solr port
|
||||
)
|
||||
));
|
||||
|
@ -106,7 +106,7 @@ class SolrReindexQueuedTest extends SapphireTest
|
||||
*/
|
||||
protected function getHandler()
|
||||
{
|
||||
return Injector::inst()->get('SolrReindexHandler');
|
||||
return Injector::inst()->get('SilverStripe\FullTextSearch\Solr\Reindex\Handlers\SolrReindexHandler');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -102,7 +102,7 @@ class SolrReindexTest extends SapphireTest
|
||||
*/
|
||||
protected function getHandler()
|
||||
{
|
||||
return Injector::inst()->get('SolrReindexHandler');
|
||||
return Injector::inst()->get('SilverStripe\FullTextSearch\Solr\Reindex\Handlers\SolrReindexHandler');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user