mirror of
https://github.com/humhub/humhub.git
synced 2025-04-20 23:21:54 +02:00
Merge branch 'develop' into enh/608-people-group-filter-limit
This commit is contained in:
commit
6913ededd7
@ -14,6 +14,7 @@ HumHub Changelog
|
||||
- Fix #7447: Update the comment counter when deleting a comment
|
||||
- Fix #7456: Fix setting manager backwards compatibility
|
||||
- Enh #7468: Remove deprecated widget `DataSaved`
|
||||
- Enh #7493: Add possibility to define content search order via module config
|
||||
- Enh #7494: Limit group filter on people page
|
||||
|
||||
1.17.3 (Unreleased)
|
||||
|
@ -11,6 +11,7 @@ namespace humhub\modules\content;
|
||||
use humhub\modules\content\components\ContentContainerActiveRecord;
|
||||
use humhub\modules\content\search\driver\AbstractDriver;
|
||||
use humhub\modules\content\search\driver\MysqlDriver;
|
||||
use humhub\modules\content\search\SearchRequest;
|
||||
use humhub\modules\space\models\Space;
|
||||
use humhub\modules\user\models\User;
|
||||
use Yii;
|
||||
@ -95,17 +96,28 @@ class Module extends \humhub\components\Module
|
||||
*/
|
||||
public $publishScheduledInterval = 10;
|
||||
|
||||
|
||||
/**
|
||||
* @var string Class name of the searching driver
|
||||
* @since 1.16
|
||||
*/
|
||||
public $searchDriverClass = MysqlDriver::class;
|
||||
|
||||
/**
|
||||
* @var string Column name for ordering of the searching results
|
||||
* @since 1.18
|
||||
*/
|
||||
public string $searchOrderBy = SearchRequest::ORDER_BY_SCORE;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
parent::init(); // TODO: Change the autogenerated stub
|
||||
parent::init();
|
||||
|
||||
$this->set('search', ['class' => $this->searchDriverClass]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ContentContainerActiveRecord $container
|
||||
* @return int
|
||||
|
@ -67,13 +67,16 @@ class SearchController extends Controller
|
||||
*/
|
||||
public function actionFind($keyword)
|
||||
{
|
||||
$driver = ContentSearchService::getDriver();
|
||||
/* @var Module $module */
|
||||
$module = Yii::$app->getModule('content');
|
||||
|
||||
$user = User::findOne(['id' => 1]);
|
||||
$options = new SearchRequest([
|
||||
'keyword' => $keyword,
|
||||
'user' => User::findOne(['id' => 1]),
|
||||
'orderBy' => $module->searchOrderBy,
|
||||
]);
|
||||
|
||||
$options = new SearchRequest(['keyword' => $keyword, 'user' => $user]);
|
||||
|
||||
$searchResultSet = $driver->search($options);
|
||||
$searchResultSet = ContentSearchService::getDriver()->search($options);
|
||||
|
||||
print "Number of hits: " . $searchResultSet->pagination->totalCount . "\n";
|
||||
|
||||
|
@ -78,7 +78,7 @@ class ContentSearchProvider implements MetaSearchProviderInterface
|
||||
$resultSet = $module->getSearchDriver()->search(new SearchRequest([
|
||||
'keyword' => $this->getKeyword(),
|
||||
'pageSize' => $maxResults,
|
||||
'orderBy' => SearchRequest::ORDER_BY_SCORE,
|
||||
'orderBy' => $module->searchOrderBy,
|
||||
]));
|
||||
|
||||
$results = [];
|
||||
|
@ -43,7 +43,7 @@ class SearchRequest extends Model
|
||||
|
||||
public array $contentContainer = [];
|
||||
|
||||
public $orderBy = self::ORDER_BY_CREATION_DATE;
|
||||
public string $orderBy = self::ORDER_BY_CREATION_DATE;
|
||||
|
||||
public ?SearchQuery $searchQuery = null;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user