mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-16 22:43:19 +00:00
porting PHRAS-1578/PHRAS-1579/PHRAS-1621/PHRAS-1675/PHRAS-1404/PHRAS-1336 to 4.1
This commit is contained in:
@@ -36,12 +36,14 @@ class SearchEngineController extends Controller
|
||||
return $this->app->redirectPath('admin_searchengine_form');
|
||||
}
|
||||
|
||||
return $this->render('admin/search-engine/elastic-search.html.twig', [
|
||||
return $this->render('admin/search-engine/search-engine-settings.html.twig', [
|
||||
'form' => $form->createView(),
|
||||
'indexer' => $this->app['elasticsearch.indexer']
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function dropIndexAction(Request $request)
|
||||
{
|
||||
$indexer = $this->app['elasticsearch.indexer'];
|
||||
@@ -87,4 +89,28 @@ class SearchEngineController extends Controller
|
||||
'action' => $this->app->url('admin_searchengine_form'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return \Symfony\Component\HttpFoundation\JsonResponse
|
||||
*/
|
||||
public function getSettingFromIndexAction(Request $request)
|
||||
{
|
||||
if (!$request->isXmlHttpRequest()) {
|
||||
$this->app->abort(400);
|
||||
}
|
||||
$indexer = $this->app['elasticsearch.indexer'];
|
||||
$index = $request->get('index');
|
||||
if (!$indexer->indexExists() || is_null($index))
|
||||
{
|
||||
return $this->app->json([
|
||||
'success' => false,
|
||||
'message' => $this->app->trans('An error occurred'),
|
||||
]);
|
||||
}
|
||||
return $this->app->json([
|
||||
'success' => true,
|
||||
'response' => $indexer->getSettings(['index' => $index])
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user