mirror of
https://github.com/flarum/framework.git
synced 2024-11-24 21:43:10 +08:00
Extract Flarum\Search namespace
This commit is contained in:
parent
4fb38d6458
commit
11bf3e34b7
|
@ -13,7 +13,7 @@ namespace Flarum\Api\Controller;
|
|||
|
||||
use Flarum\Api\UrlGenerator;
|
||||
use Flarum\Discussion\Search\DiscussionSearcher;
|
||||
use Flarum\Core\Search\SearchCriteria;
|
||||
use Flarum\Search\SearchCriteria;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Tobscure\JsonApi\Document;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Flarum\Api\Controller;
|
|||
|
||||
use Flarum\Api\UrlGenerator;
|
||||
use Flarum\User\Exception\PermissionDeniedException;
|
||||
use Flarum\Core\Search\SearchCriteria;
|
||||
use Flarum\Search\SearchCriteria;
|
||||
use Flarum\Core\User\Search\UserSearcher;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Tobscure\JsonApi\Document;
|
||||
|
|
|
@ -41,7 +41,7 @@ class CoreServiceProvider extends AbstractServiceProvider
|
|||
$this->registerAvatarsFilesystem();
|
||||
|
||||
$this->app->register('Flarum\Core\Notification\NotificationServiceProvider');
|
||||
$this->app->register('Flarum\Core\Search\SearchServiceProvider');
|
||||
$this->app->register('Flarum\Search\SearchServiceProvider');
|
||||
$this->app->register('Flarum\Formatter\FormatterServiceProvider');
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Flarum\Discussion\Search;
|
||||
|
||||
use Flarum\Core\Search\AbstractSearch;
|
||||
use Flarum\Search\AbstractSearch;
|
||||
|
||||
/**
|
||||
* An object which represents the internal state of a search for discussions:
|
||||
|
|
|
@ -15,10 +15,10 @@ use Flarum\Discussion\Discussion;
|
|||
use Flarum\Discussion\DiscussionRepository;
|
||||
use Flarum\Discussion\Search\DiscussionSearch;
|
||||
use Flarum\Post\PostRepository;
|
||||
use Flarum\Core\Search\ApplySearchParametersTrait;
|
||||
use Flarum\Core\Search\GambitManager;
|
||||
use Flarum\Core\Search\SearchCriteria;
|
||||
use Flarum\Core\Search\SearchResults;
|
||||
use Flarum\Search\ApplySearchParametersTrait;
|
||||
use Flarum\Search\GambitManager;
|
||||
use Flarum\Search\SearchCriteria;
|
||||
use Flarum\Search\SearchResults;
|
||||
use Flarum\Event\ConfigureDiscussionSearch;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
|
@ -31,7 +31,7 @@ class DiscussionSearcher
|
|||
use ApplySearchParametersTrait;
|
||||
|
||||
/**
|
||||
* @var GambitManager
|
||||
* @var \Flarum\Search\GambitManager
|
||||
*/
|
||||
protected $gambits;
|
||||
|
||||
|
@ -46,7 +46,7 @@ class DiscussionSearcher
|
|||
protected $posts;
|
||||
|
||||
/**
|
||||
* @param GambitManager $gambits
|
||||
* @param \Flarum\Search\GambitManager $gambits
|
||||
* @param DiscussionRepository $discussions
|
||||
* @param PostRepository $posts
|
||||
*/
|
||||
|
@ -61,13 +61,13 @@ class DiscussionSearcher
|
|||
}
|
||||
|
||||
/**
|
||||
* @param SearchCriteria $criteria
|
||||
* @param \Flarum\Search\SearchCriteria $criteria
|
||||
* @param int|null $limit
|
||||
* @param int $offset
|
||||
* @param array $load An array of relationships to load on the results.
|
||||
* @return SearchResults
|
||||
* @return \Flarum\Search\SearchResults
|
||||
*/
|
||||
public function search(SearchCriteria $criteria, $limit = null, $offset = 0, array $load = [])
|
||||
public function search(\Flarum\Search\SearchCriteria $criteria, $limit = null, $offset = 0, array $load = [])
|
||||
{
|
||||
$actor = $criteria->actor;
|
||||
|
||||
|
@ -110,7 +110,7 @@ class DiscussionSearcher
|
|||
Discussion::setStateUser($actor);
|
||||
$discussions->load($load);
|
||||
|
||||
return new SearchResults($discussions, $areMoreResults);
|
||||
return new \Flarum\Search\SearchResults($discussions, $areMoreResults);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
namespace Flarum\Discussion\Search\Gambit;
|
||||
|
||||
use Flarum\User\UserRepository;
|
||||
use Flarum\Core\Search\AbstractRegexGambit;
|
||||
use Flarum\Core\Search\AbstractSearch;
|
||||
use Flarum\Search\AbstractRegexGambit;
|
||||
use Flarum\Search\AbstractSearch;
|
||||
use Flarum\Discussion\Search\DiscussionSearch;
|
||||
use LogicException;
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
namespace Flarum\Discussion\Search\Gambit;
|
||||
|
||||
use Flarum\Core\Search\AbstractRegexGambit;
|
||||
use Flarum\Core\Search\AbstractSearch;
|
||||
use Flarum\Search\AbstractRegexGambit;
|
||||
use Flarum\Search\AbstractSearch;
|
||||
use Flarum\Discussion\Search\DiscussionSearch;
|
||||
use LogicException;
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
|
||||
namespace Flarum\Discussion\Search\Gambit;
|
||||
|
||||
use Flarum\Core\Search\AbstractSearch;
|
||||
use Flarum\Search\AbstractSearch;
|
||||
use Flarum\Discussion\Search\DiscussionSearch;
|
||||
use Flarum\Discussion\Search\Fulltext\DriverInterface;
|
||||
use Flarum\Core\Search\GambitInterface;
|
||||
use Flarum\Search\GambitInterface;
|
||||
use LogicException;
|
||||
|
||||
class FulltextGambit implements GambitInterface
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
namespace Flarum\Discussion\Search\Gambit;
|
||||
|
||||
use Flarum\Core\Search\AbstractRegexGambit;
|
||||
use Flarum\Core\Search\AbstractSearch;
|
||||
use Flarum\Search\AbstractRegexGambit;
|
||||
use Flarum\Search\AbstractSearch;
|
||||
use Flarum\Discussion\Search\DiscussionSearch;
|
||||
use LogicException;
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
namespace Flarum\Discussion\Search\Gambit;
|
||||
|
||||
use Flarum\Discussion\DiscussionRepository;
|
||||
use Flarum\Core\Search\AbstractRegexGambit;
|
||||
use Flarum\Core\Search\AbstractSearch;
|
||||
use Flarum\Search\AbstractRegexGambit;
|
||||
use Flarum\Search\AbstractSearch;
|
||||
use Flarum\Discussion\Search\DiscussionSearch;
|
||||
use LogicException;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Flarum\Event;
|
||||
|
||||
use Flarum\Core\Search\GambitManager;
|
||||
use Flarum\Search\GambitManager;
|
||||
|
||||
abstract class AbstractConfigureGambits
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ abstract class AbstractConfigureGambits
|
|||
public $gambits;
|
||||
|
||||
/**
|
||||
* @param GambitManager $gambits
|
||||
* @param \Flarum\Search\GambitManager $gambits
|
||||
*/
|
||||
public function __construct(GambitManager $gambits)
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
namespace Flarum\Event;
|
||||
|
||||
use Flarum\Discussion\Search\DiscussionSearch;
|
||||
use Flarum\Core\Search\SearchCriteria;
|
||||
use Flarum\Search\SearchCriteria;
|
||||
|
||||
class ConfigureDiscussionSearch
|
||||
{
|
||||
|
@ -22,13 +22,13 @@ class ConfigureDiscussionSearch
|
|||
public $search;
|
||||
|
||||
/**
|
||||
* @var SearchCriteria
|
||||
* @var \Flarum\Search\SearchCriteria
|
||||
*/
|
||||
public $criteria;
|
||||
|
||||
/**
|
||||
* @param DiscussionSearch $search
|
||||
* @param SearchCriteria $criteria
|
||||
* @param \Flarum\Search\SearchCriteria $criteria
|
||||
*/
|
||||
public function __construct(DiscussionSearch $search, SearchCriteria $criteria)
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Flarum\Event;
|
||||
|
||||
use Flarum\Core\Search\SearchCriteria;
|
||||
use Flarum\Search\SearchCriteria;
|
||||
use Flarum\Core\User\Search\UserSearch;
|
||||
|
||||
class ConfigureUserSearch
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Core\Search;
|
||||
namespace Flarum\Search;
|
||||
|
||||
abstract class AbstractRegexGambit implements GambitInterface
|
||||
{
|
|
@ -9,7 +9,7 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Core\Search;
|
||||
namespace Flarum\Search;
|
||||
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Database\Query\Builder;
|
|
@ -9,7 +9,7 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Core\Search;
|
||||
namespace Flarum\Search;
|
||||
|
||||
trait ApplySearchParametersTrait
|
||||
{
|
|
@ -9,7 +9,7 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Core\Search;
|
||||
namespace Flarum\Search;
|
||||
|
||||
interface GambitInterface
|
||||
{
|
|
@ -9,7 +9,7 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Core\Search;
|
||||
namespace Flarum\Search;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use LogicException;
|
|
@ -9,7 +9,7 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Core\Search;
|
||||
namespace Flarum\Search;
|
||||
|
||||
use Flarum\User\User;
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Core\Search;
|
||||
namespace Flarum\Search;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Core\Search;
|
||||
namespace Flarum\Search;
|
||||
|
||||
use Flarum\Event\ConfigureDiscussionGambits;
|
||||
use Flarum\Event\ConfigureUserGambits;
|
||||
|
@ -38,7 +38,7 @@ class SearchServiceProvider extends AbstractServiceProvider
|
|||
public function registerUserGambits()
|
||||
{
|
||||
$this->app->when('Flarum\Core\User\Search\UserSearcher')
|
||||
->needs('Flarum\Core\Search\GambitManager')
|
||||
->needs('Flarum\Search\GambitManager')
|
||||
->give(function (Container $app) {
|
||||
$gambits = new GambitManager($app);
|
||||
|
||||
|
@ -57,7 +57,7 @@ class SearchServiceProvider extends AbstractServiceProvider
|
|||
public function registerDiscussionGambits()
|
||||
{
|
||||
$this->app->when('Flarum\Discussion\Search\DiscussionSearcher')
|
||||
->needs('Flarum\Core\Search\GambitManager')
|
||||
->needs('Flarum\Search\GambitManager')
|
||||
->give(function (Container $app) {
|
||||
$gambits = new GambitManager($app);
|
||||
|
|
@ -12,8 +12,8 @@
|
|||
namespace Flarum\Core\User\Search\Gambit;
|
||||
|
||||
use Flarum\User\UserRepository;
|
||||
use Flarum\Core\Search\AbstractRegexGambit;
|
||||
use Flarum\Core\Search\AbstractSearch;
|
||||
use Flarum\Search\AbstractRegexGambit;
|
||||
use Flarum\Search\AbstractSearch;
|
||||
use Flarum\Core\User\Search\UserSearch;
|
||||
use LogicException;
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
namespace Flarum\Core\User\Search\Gambit;
|
||||
|
||||
use Flarum\User\UserRepository;
|
||||
use Flarum\Core\Search\AbstractSearch;
|
||||
use Flarum\Core\Search\GambitInterface;
|
||||
use Flarum\Search\AbstractSearch;
|
||||
use Flarum\Search\GambitInterface;
|
||||
|
||||
class FulltextGambit implements GambitInterface
|
||||
{
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
namespace Flarum\Core\User\Search\Gambit;
|
||||
|
||||
use Flarum\Core\Repository\GroupRepository;
|
||||
use Flarum\Core\Search\AbstractRegexGambit;
|
||||
use Flarum\Core\Search\AbstractSearch;
|
||||
use Flarum\Search\AbstractRegexGambit;
|
||||
use Flarum\Search\AbstractSearch;
|
||||
use Flarum\Core\User\Search\UserSearch;
|
||||
use LogicException;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Flarum\Core\User\Search;
|
||||
|
||||
use Flarum\Core\Search\AbstractSearch;
|
||||
use Flarum\Search\AbstractSearch;
|
||||
|
||||
class UserSearch extends AbstractSearch
|
||||
{
|
||||
|
|
|
@ -13,10 +13,10 @@ namespace Flarum\Core\User\Search;
|
|||
|
||||
use Flarum\Core\User\Search\UserSearch;
|
||||
use Flarum\User\UserRepository;
|
||||
use Flarum\Core\Search\ApplySearchParametersTrait;
|
||||
use Flarum\Core\Search\GambitManager;
|
||||
use Flarum\Core\Search\SearchCriteria;
|
||||
use Flarum\Core\Search\SearchResults;
|
||||
use Flarum\Search\ApplySearchParametersTrait;
|
||||
use Flarum\Search\GambitManager;
|
||||
use Flarum\Search\SearchCriteria;
|
||||
use Flarum\Search\SearchResults;
|
||||
use Flarum\Event\ConfigureUserSearch;
|
||||
|
||||
/**
|
||||
|
@ -28,7 +28,7 @@ class UserSearcher
|
|||
use ApplySearchParametersTrait;
|
||||
|
||||
/**
|
||||
* @var GambitManager
|
||||
* @var \Flarum\Search\GambitManager
|
||||
*/
|
||||
protected $gambits;
|
||||
|
||||
|
@ -38,10 +38,10 @@ class UserSearcher
|
|||
protected $users;
|
||||
|
||||
/**
|
||||
* @param GambitManager $gambits
|
||||
* @param \Flarum\Search\GambitManager $gambits
|
||||
* @param \Flarum\User\UserRepository $users
|
||||
*/
|
||||
public function __construct(GambitManager $gambits, UserRepository $users)
|
||||
public function __construct(\Flarum\Search\GambitManager $gambits, UserRepository $users)
|
||||
{
|
||||
$this->gambits = $gambits;
|
||||
$this->users = $users;
|
||||
|
@ -52,9 +52,9 @@ class UserSearcher
|
|||
* @param int|null $limit
|
||||
* @param int $offset
|
||||
* @param array $load An array of relationships to load on the results.
|
||||
* @return SearchResults
|
||||
* @return \Flarum\Search\SearchResults
|
||||
*/
|
||||
public function search(SearchCriteria $criteria, $limit = null, $offset = 0, array $load = [])
|
||||
public function search(\Flarum\Search\SearchCriteria $criteria, $limit = null, $offset = 0, array $load = [])
|
||||
{
|
||||
$actor = $criteria->actor;
|
||||
|
||||
|
@ -83,6 +83,6 @@ class UserSearcher
|
|||
|
||||
$users->load($load);
|
||||
|
||||
return new SearchResults($users, $areMoreResults);
|
||||
return new \Flarum\Search\SearchResults($users, $areMoreResults);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user