mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 03:53:13 +00:00
[SearchEngine] CS cleanup
This commit is contained in:
@@ -7,7 +7,6 @@ use Symfony\Component\HttpFoundation\Request;
|
|||||||
|
|
||||||
interface ConfigurationPanelInterface
|
interface ConfigurationPanelInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
public function get(Application $app, Request $request);
|
public function get(Application $app, Request $request);
|
||||||
|
|
||||||
public function post(Application $app, Request $request);
|
public function post(Application $app, Request $request);
|
||||||
|
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace Alchemy\Phrasea\SearchEngine\Phrasea;
|
namespace Alchemy\Phrasea\SearchEngine\Phrasea;
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\Application;
|
||||||
use Alchemy\Phrasea\SearchEngine\ConfigurationPanelInterface;
|
use Alchemy\Phrasea\SearchEngine\ConfigurationPanelInterface;
|
||||||
use Silex\Application;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
class ConfigurationPanel implements ConfigurationPanelInterface
|
class ConfigurationPanel implements ConfigurationPanelInterface
|
||||||
@@ -18,7 +18,6 @@ class ConfigurationPanel implements ConfigurationPanelInterface
|
|||||||
|
|
||||||
public function get(Application $app, Request $request)
|
public function get(Application $app, Request $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
return $app['twig']->render('admin/search-engine/phrasea.html.twig', array());
|
return $app['twig']->render('admin/search-engine/phrasea.html.twig', array());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,5 +25,4 @@ class ConfigurationPanel implements ConfigurationPanelInterface
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -16,8 +16,6 @@ use Alchemy\Phrasea\SearchEngine\SearchEngineOptions;
|
|||||||
use Alchemy\Phrasea\SearchEngine\SearchEngineResult;
|
use Alchemy\Phrasea\SearchEngine\SearchEngineResult;
|
||||||
use Alchemy\Phrasea\Exception\RuntimeException;
|
use Alchemy\Phrasea\Exception\RuntimeException;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Silex\Application;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
|
|
||||||
class PhraseaEngine implements SearchEngineInterface
|
class PhraseaEngine implements SearchEngineInterface
|
||||||
{
|
{
|
||||||
|
@@ -15,8 +15,6 @@ use Alchemy\Phrasea\SearchEngine\SearchEngineOptions;
|
|||||||
use Alchemy\Phrasea\SearchEngine\SearchEngineResult;
|
use Alchemy\Phrasea\SearchEngine\SearchEngineResult;
|
||||||
use Alchemy\Phrasea\Exception\RuntimeException;
|
use Alchemy\Phrasea\Exception\RuntimeException;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Silex\Application;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
|
|
||||||
interface SearchEngineInterface
|
interface SearchEngineInterface
|
||||||
{
|
{
|
||||||
|
@@ -186,7 +186,7 @@ class SearchEngineOptions implements \Serializable
|
|||||||
*/
|
*/
|
||||||
public function useStemming($boolean)
|
public function useStemming($boolean)
|
||||||
{
|
{
|
||||||
$this->stemming = ! ! $boolean;
|
$this->stemming = !!$boolean;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@@ -285,15 +285,18 @@ class SearchEngineOptions implements \Serializable
|
|||||||
{
|
{
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
foreach ($status as $n => $options) {
|
foreach ($status as $n => $options) {
|
||||||
if (count($options) > 1)
|
if (count($options) > 1) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if (isset($options['on'])) {
|
if (isset($options['on'])) {
|
||||||
foreach ($options['on'] as $sbas_id)
|
foreach ($options['on'] as $sbas_id) {
|
||||||
$tmp[$n][$sbas_id] = 1;
|
$tmp[$n][$sbas_id] = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (isset($options['off'])) {
|
if (isset($options['off'])) {
|
||||||
foreach ($options['off'] as $sbas_id)
|
foreach ($options['off'] as $sbas_id) {
|
||||||
$tmp[$n][$sbas_id] = 0;
|
$tmp[$n][$sbas_id] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,7 +362,7 @@ class SearchEngineOptions implements \Serializable
|
|||||||
*/
|
*/
|
||||||
public function setMinDate($min_date)
|
public function setMinDate($min_date)
|
||||||
{
|
{
|
||||||
if ( ! is_null($min_date) && trim($min_date) !== '') {
|
if (!is_null($min_date) && trim($min_date) !== '') {
|
||||||
$this->date_min = DateTime::createFromFormat('Y/m/d H:i:s', $min_date . ' 00:00:00');
|
$this->date_min = DateTime::createFromFormat('Y/m/d H:i:s', $min_date . ' 00:00:00');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,8 +385,8 @@ class SearchEngineOptions implements \Serializable
|
|||||||
*/
|
*/
|
||||||
public function setMaxDate($max_date)
|
public function setMaxDate($max_date)
|
||||||
{
|
{
|
||||||
if ( ! is_null($max_date) && trim($max_date) !== '') {
|
if (!is_null($max_date) && trim($max_date) !== '') {
|
||||||
$this->date_max = DateTime::createFromFormat('Y/m/d H:i:s', $max_date . ' 23:59:59');
|
$this->date_max = \DateTime::createFromFormat('Y/m/d H:i:s', $max_date . ' 23:59:59');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@@ -427,7 +430,7 @@ class SearchEngineOptions implements \Serializable
|
|||||||
{
|
{
|
||||||
$ret = array();
|
$ret = array();
|
||||||
foreach ($this as $key => $value) {
|
foreach ($this as $key => $value) {
|
||||||
if ($value instanceof DateTime) {
|
if ($value instanceof \DateTime) {
|
||||||
$value = $value->format('d-m-Y h:i:s');
|
$value = $value->format('d-m-Y h:i:s');
|
||||||
}
|
}
|
||||||
if (in_array($key, array('collections', 'business_fields'))) {
|
if (in_array($key, array('collections', 'business_fields'))) {
|
||||||
|
Reference in New Issue
Block a user