mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Merge pull request #29 from nlegoff/pr-preview
Fix record preview in production
This commit is contained in:
@@ -221,7 +221,7 @@ class Query implements ControllerProviderInterface
|
|||||||
|
|
||||||
return $app->json([
|
return $app->json([
|
||||||
'current' => $app['twig']->render('prod/preview/result_train.html.twig', [
|
'current' => $app['twig']->render('prod/preview/result_train.html.twig', [
|
||||||
'records' => $record->get_train($pos, $query, $app['phraseanet.SE']),
|
'records' => $record->get_train($pos, $query, $app['phraseanet.SE'], $options),
|
||||||
'selected' => $pos
|
'selected' => $pos
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
|
@@ -497,6 +497,8 @@ class SearchEngineOptions
|
|||||||
$options = new static();
|
$options = new static();
|
||||||
$options->disallowBusinessFields();
|
$options->disallowBusinessFields();
|
||||||
|
|
||||||
|
$sort_by = $sort_ord = null;
|
||||||
|
|
||||||
foreach ($serialized as $key => $value) {
|
foreach ($serialized as $key => $value) {
|
||||||
|
|
||||||
switch (true) {
|
switch (true) {
|
||||||
@@ -530,8 +532,6 @@ class SearchEngineOptions
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sort_by = $sort_ord = null;
|
|
||||||
|
|
||||||
switch ($key) {
|
switch ($key) {
|
||||||
case 'record_type':
|
case 'record_type':
|
||||||
$options->setRecordType($value);
|
$options->setRecordType($value);
|
||||||
|
@@ -204,7 +204,7 @@ class record_preview extends record_adapter
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_train($pos = 0, $query = '', SearchEngineInterface $search_engine = null)
|
public function get_train($pos = 0, $query = '', SearchEngineInterface $search_engine = null, SearchEngineOptions $options)
|
||||||
{
|
{
|
||||||
if ($this->train) {
|
if ($this->train) {
|
||||||
return $this->train;
|
return $this->train;
|
||||||
@@ -214,7 +214,7 @@ class record_preview extends record_adapter
|
|||||||
case 'RESULT':
|
case 'RESULT':
|
||||||
$perPage = 56;
|
$perPage = 56;
|
||||||
$index = ($pos - 3) < 0 ? 0 : ($pos - 3);
|
$index = ($pos - 3) < 0 ? 0 : ($pos - 3);
|
||||||
$results = $search_engine->query($query, $index, $perPage);
|
$results = $search_engine->query($query, $index, $perPage, $options);
|
||||||
|
|
||||||
$this->train = $results->getResults()->toArray();
|
$this->train = $results->getResults()->toArray();
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user