mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-24 10:23:17 +00:00
PHRAS-1101_THMB-TRAIN-IN-PREVIEW
backport from master #time 30m
This commit is contained in:
@@ -14,6 +14,7 @@ namespace Alchemy\Phrasea\SearchEngine;
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Authentication\ACLProvider;
|
||||
use Alchemy\Phrasea\Authentication\Authenticator;
|
||||
use Alchemy\Phrasea\Collection\CollectionRepository;
|
||||
use Alchemy\Phrasea\Collection\Reference\CollectionReferenceCollection;
|
||||
use Assert\Assertion;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -74,10 +75,12 @@ class SearchEngineOptions
|
||||
$collections = [];
|
||||
|
||||
foreach ($references->groupByDataboxIdAndCollectionId() as $databoxId => $indexes) {
|
||||
/** @var CollectionRepository $repository */
|
||||
$repository = $app['repo.collections-registry']->getRepositoryByDatabox($databoxId);
|
||||
|
||||
foreach ($indexes as $collectionId => $index) {
|
||||
$collections[] = $repository->find($collectionId);
|
||||
$coll = $repository->find($collectionId);
|
||||
$collections[$coll->get_base_id()] = $coll;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,9 +127,9 @@ class SearchEngineOptions
|
||||
}
|
||||
|
||||
/** @var string */
|
||||
protected $record_type;
|
||||
protected $record_type = self::TYPE_ALL;
|
||||
|
||||
protected $search_type = 0;
|
||||
protected $search_type = self::RECORD_RECORD;
|
||||
/** @var \collection[] */
|
||||
protected $collections = [];
|
||||
/** @var null|\databox[] */
|
||||
|
||||
@@ -21,11 +21,13 @@ class SearchEngineOptionsTest extends \PhraseanetTestCase
|
||||
$app = self::$DI['app'];
|
||||
/** @var \collection $collection */
|
||||
$collection = self::$DI['collection'];
|
||||
$collections[$collection->get_base_id()] = $collection;
|
||||
|
||||
$options = new SearchEngineOptions($app);
|
||||
$options->onCollections([$collection]);
|
||||
|
||||
$options->allowBusinessFieldsOn([$collection]);
|
||||
$options->onCollections($collections);
|
||||
$options->setRecordType(SearchEngineOptions::TYPE_ALL);
|
||||
$options->setSearchType(SearchEngineOptions::RECORD_RECORD);
|
||||
$options->allowBusinessFieldsOn($collections);
|
||||
|
||||
foreach ($collection->get_databox()->get_meta_structure() as $field) {
|
||||
$options->setFields([$field]);
|
||||
@@ -35,9 +37,9 @@ class SearchEngineOptionsTest extends \PhraseanetTestCase
|
||||
|
||||
$min_date = new \DateTime('-5 days');
|
||||
$max_date = new \DateTime('+5 days');
|
||||
|
||||
$options->setMinDate(\DateTime::createFromFormat(DATE_ATOM, $min_date->format(DATE_ATOM)));
|
||||
$options->setMaxDate(\DateTime::createFromFormat(DATE_ATOM, $max_date->format(DATE_ATOM)));
|
||||
|
||||
$options->setFirstResult(3);
|
||||
$options->setMaxResults(42);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user