Merge pull request #29 from nlegoff/pr-preview

Fix record preview in production
This commit is contained in:
Mathieu Darse
2015-02-23 18:19:40 +01:00
3 changed files with 5 additions and 5 deletions

View File

@@ -221,7 +221,7 @@ class Query implements ControllerProviderInterface
return $app->json([
'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
])
]);

View File

@@ -497,6 +497,8 @@ class SearchEngineOptions
$options = new static();
$options->disallowBusinessFields();
$sort_by = $sort_ord = null;
foreach ($serialized as $key => $value) {
switch (true) {
@@ -530,8 +532,6 @@ class SearchEngineOptions
break;
}
$sort_by = $sort_ord = null;
switch ($key) {
case 'record_type':
$options->setRecordType($value);

View File

@@ -204,7 +204,7 @@ class record_preview extends record_adapter
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) {
return $this->train;
@@ -214,7 +214,7 @@ class record_preview extends record_adapter
case 'RESULT':
$perPage = 56;
$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();
break;