Completed
Branch master (ffc11c)
by Gaetano
16:51
created
Command/TestCommand.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,6 @@
 block discarded – undo
9 9
 use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
10 10
 use eZ\Publish\API\Repository\Values\Content\Query\SortClause;
11 11
 use Kaliop\EzFindSearchEngineBundle\API\Repository\Values\Content\Query as KQuery;
12
-use Kaliop\EzFindSearchEngineBundle\API\Repository\Values\Content\Query\SortClause as KSortClause;
13 12
 use Kaliop\EzFindSearchEngineBundle\API\Repository\Values\Content\Query\Criterion as KCriterion;
14 13
 
15 14
 class TestCommand extends ContainerAwareCommand
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
         $legacyKernelClosure = $this->getContainer()->get('ezpublish_legacy.kernel');
29 29
         $legacyKernel = $legacyKernelClosure();
30 30
         $legacyKernel->runCallback(
31
-            function ()  {
31
+            function() {
32 32
                 $moduleRepositories = \eZModule::activeModuleRepositories(true);
33 33
                 $moduleRepositories[] = 'extension/ezfind/modules';
34 34
                 //var_dump($moduleRepositories);
35
-                \eZModule::setGlobalPathList( $moduleRepositories );
35
+                \eZModule::setGlobalPathList($moduleRepositories);
36 36
             },
37 37
             false
38 38
         );
@@ -82,12 +82,12 @@  discard block
 block discarded – undo
82 82
         echo "count: "; var_dump(count($results->searchHits));
83 83
         echo "totalCount: "; var_dump($results->totalCount);
84 84
         echo "time (ms): "; var_dump($results->time);
85
-        echo "maxScore: ";  var_dump($results->maxScore);
85
+        echo "maxScore: "; var_dump($results->maxScore);
86 86
         echo "q: "; var_dump($results->searchExtras->attribute('responseHeader')['params']['q']);
87 87
         echo "fq: "; var_dump($results->searchExtras->attribute('responseHeader')['params']['fq']);
88 88
         echo "sort: "; var_dump($results->searchExtras->attribute('responseHeader')['params']['sort']);
89 89
 
90
-        foreach($results->searchHits as $i => $searchHit) {
90
+        foreach ($results->searchHits as $i => $searchHit) {
91 91
             /** @var Content $content */
92 92
             $content = $searchHit->valueObject;
93 93
             $score = $searchHit->score;
Please login to merge, or discard this patch.
eZFind/Content/Search/Common/Gateway/CriterionHandler/FieldIn.php 1 patch
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -3,11 +3,8 @@
 block discarded – undo
3 3
 namespace Kaliop\EzFindSearchEngineBundle\Core\Persistence\eZFind\Content\Search\Common\Gateway\CriterionHandler;
4 4
 
5 5
 use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
6
-use eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator;
7 6
 use Kaliop\EzFindSearchEngineBundle\Core\Persistence\eZFind\Content\Search\Common\Gateway\CriteriaConverter;
8 7
 use Kaliop\EzFindSearchEngineBundle\Core\Persistence\eZFind\Content\Search\Common\Gateway\CriterionHandler;
9
-use Kaliop\EzFindSearchEngineBundle\Persistence\Solr\Content\Search\CriterionVisitor;
10
-use Kaliop\EzFindSearchEngineBundle\Persistence\Solr\Content\Search\CriterionVisitorDispatcher;
11 8
 
12 9
 /// @deprecated
13 10
 class FieldIn extends FieldBase
Please login to merge, or discard this patch.
eZFind/Content/Search/Common/Gateway/CriterionHandler/LocationId.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
15 15
 
16 16
     /**
17 17
      * @param CriteriaConverter $converter
18
-     * @param SelectQuery $query
19 18
      * @param Criterion $criterion
20 19
      * @return string|string[]
21 20
      */
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 class LocationId extends CriterionHandler
10 10
 {
11
-    public function accept( Criterion $criterion )
11
+    public function accept(Criterion $criterion)
12 12
     {
13 13
         return $criterion instanceof Criterion\LocationId;
14 14
     }
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
      * @param Criterion $criterion
20 20
      * @return string|string[]
21 21
      */
22
-    public function handle( CriteriaConverter $converter, Criterion $criterion )
22
+    public function handle(CriteriaConverter $converter, Criterion $criterion)
23 23
     {
24 24
         $result = [];
25 25
 
Please login to merge, or discard this patch.
eZFind/Content/Search/Common/Gateway/CriterionHandler/LogicalAnd.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -5,8 +5,6 @@
 block discarded – undo
5 5
 use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
6 6
 use Kaliop\EzFindSearchEngineBundle\Core\Persistence\eZFind\Content\Search\Common\Gateway\CriteriaConverter;
7 7
 use Kaliop\EzFindSearchEngineBundle\Core\Persistence\eZFind\Content\Search\Common\Gateway\CriterionHandler;
8
-use Kaliop\EzFindSearchEngineBundle\Persistence\Solr\Content\Search\CriterionVisitor;
9
-use Kaliop\EzFindSearchEngineBundle\Persistence\Solr\Content\Search\CriterionVisitorDispatcher as Dispatcher;
10 8
 
11 9
 class LogicalAnd extends CriterionHandler
12 10
 {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
         return array_merge(
21 21
             array('AND'),
22 22
             array_map(
23
-                function ($value) use ($converter) {
23
+                function($value) use ($converter) {
24 24
                     return $converter->handle($value);
25 25
                 },
26 26
                 $criterion->criteria
Please login to merge, or discard this patch.
eZFind/Content/Search/Common/Gateway/CriterionHandler/LogicalNot.php 1 patch
Unused Use Statements   -4 removed lines patch added patch discarded remove patch
@@ -2,14 +2,10 @@
 block discarded – undo
2 2
 
3 3
 namespace Kaliop\EzFindSearchEngineBundle\Core\Persistence\eZFind\Content\Search\Common\Gateway\CriterionHandler;
4 4
 
5
-use eZ\Publish\API\Repository\Values\Content\Query;
6 5
 use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
7
-use eZ\Publish\Core\Persistence\Database\SelectQuery;
8 6
 use Kaliop\EzFindSearchEngineBundle\Core\Base\Exceptions\InvalidCriterionException;
9 7
 use Kaliop\EzFindSearchEngineBundle\Core\Persistence\eZFind\Content\Search\Common\Gateway\CriteriaConverter;
10 8
 use Kaliop\EzFindSearchEngineBundle\Core\Persistence\eZFind\Content\Search\Common\Gateway\CriterionHandler;
11
-use Kaliop\EzFindSearchEngineBundle\Persistence\Solr\Content\Search\CriterionVisitor;
12
-use Kaliop\EzFindSearchEngineBundle\Persistence\Solr\Content\Search\CriterionVisitorDispatcher as Dispatcher;
13 9
 
14 10
 class LogicalNot extends CriterionHandler
15 11
 {
Please login to merge, or discard this patch.
eZFind/Content/Search/Common/Gateway/CriterionHandler/LogicalOr.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
6 6
 use Kaliop\EzFindSearchEngineBundle\Core\Persistence\eZFind\Content\Search\Common\Gateway\CriteriaConverter;
7
-use Kaliop\EzFindSearchEngineBundle\Persistence\Solr\Content\Search\CriterionVisitor;
8
-use Kaliop\EzFindSearchEngineBundle\Persistence\Solr\Content\Search\CriterionVisitorDispatcher as Dispatcher;
9 7
 use Kaliop\EzFindSearchEngineBundle\Core\Persistence\eZFind\Content\Search\Common\Gateway\CriterionHandler;
10 8
 
11 9
 class LogicalOr extends CriterionHandler
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
         return array_merge(
21 21
             array('OR'),
22 22
             array_map(
23
-                function ($value) use ($converter) {
23
+                function($value) use ($converter) {
24 24
                     return $converter->handle($value);
25 25
                 },
26 26
                 $criterion->criteria
Please login to merge, or discard this patch.
eZFind/Content/Search/Common/Gateway/CriterionHandler/ObjectStateId.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
15 15
 
16 16
     /**
17 17
      * @param CriteriaConverter $converter
18
-     * @param SelectQuery $query
19 18
      * @param Criterion $criterion
20 19
      * @return string|string[]
21 20
      *
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 class ObjectStateId extends CriterionHandler
10 10
 {
11
-    public function accept( Criterion $criterion )
11
+    public function accept(Criterion $criterion)
12 12
     {
13 13
         return $criterion instanceof Criterion\ObjectStateId;
14 14
     }
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      *
22 22
      * @todo verify if handling of multiple states via OR is correct
23 23
      */
24
-    public function handle( CriteriaConverter $converter, Criterion $criterion )
24
+    public function handle(CriteriaConverter $converter, Criterion $criterion)
25 25
     {
26 26
         $result = [];
27 27
 
Please login to merge, or discard this patch.
Core/Repository/SearchService.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -345,6 +345,9 @@  discard block
 block discarded – undo
345 345
         return $searchParameters;
346 346
     }
347 347
 
348
+    /**
349
+     * @param string $paramName
350
+     */
348 351
     protected function extractLegacyParameter($paramName, Query $query)
349 352
     {
350 353
         switch ($paramName) {
@@ -422,6 +425,9 @@  discard block
 block discarded – undo
422 425
         return $facets;
423 426
     }
424 427
 
428
+    /**
429
+     * @param Query\SortClause[] $sortClauses
430
+     */
425 431
     protected function extractSort($sortClauses)
426 432
     {
427 433
         $result = [];
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 
128 128
             // trick to access data from a protected member of ezfSearchResultInfo
129 129
             // @see http://blag.kazeno.net/development/access-private-protected-properties
130
-            $propGetter = Closure::bind(function($prop){return $this->$prop;}, $extras, $extras);
130
+            $propGetter = Closure::bind(function($prop) {return $this->$prop; }, $extras, $extras);
131 131
             $resultArray = $propGetter('ResultArray');
132 132
 
133 133
             if (isset($resultArray['response']['maxScore'])) {
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
             // optimize: remove from SearchExtras 'response' to save memory using the 'Closure::bind' hack
138 138
             /// @todo (!important) make the cutover limit configurable
139 139
             if ($result['SearchCount'] > 100) {
140
-                $resultsCleaner = Closure::bind(function(){unset($this->ResultArray['response']['docs']);}, $extras, $extras);
140
+                $resultsCleaner = Closure::bind(function() {unset($this->ResultArray['response']['docs']); }, $extras, $extras);
141 141
                 $resultsCleaner();
142 142
             }
143 143
         }
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 
239 239
         /** @var array $searchResult */
240 240
         $searchResult = $this->getLegacyKernel()->runCallback(
241
-            function () use ($searchParameters) {
241
+            function() use ($searchParameters) {
242 242
                 return \eZFunctionHandler::execute($this->ezFindModule, $this->ezFindFunction, $searchParameters);
243 243
             },
244 244
             false
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 
498 498
             // trick to access data from a protected member of ezfSearchResultInfo
499 499
             // @see http://blag.kazeno.net/development/access-private-protected-properties
500
-            $propGetter = Closure::bind(function($prop){return $this->$prop;}, $extras, $extras);
500
+            $propGetter = Closure::bind(function($prop) {return $this->$prop; }, $extras, $extras);
501 501
             $resultArray = $propGetter('ResultArray');
502 502
             $searchResults = $resultArray['response']['docs'];
503 503
         }
@@ -509,16 +509,16 @@  discard block
 block discarded – undo
509 509
         $results = array();
510 510
 
511 511
         foreach ($searchResults as $index => $result) {
512
-            switch($returnType) {
512
+            switch ($returnType) {
513 513
 
514 514
                 case KaliopQuery::RETURN_CONTENTS:
515 515
                     try {
516 516
                         $results[$index] = new SearchHit(
517 517
                             [
518 518
                                 'valueObject' => $this->contentService->loadContent($result['id']),
519
-                                'score' => isset($result['score'])? $result['score'] : null,
520
-                                'highlight' => isset($result['highlight'])? $result['highlight'] : null,
521
-                                'elevated' => isset($result['elevated'])? $result['elevated'] : null,
519
+                                'score' => isset($result['score']) ? $result['score'] : null,
520
+                                'highlight' => isset($result['highlight']) ? $result['highlight'] : null,
521
+                                'elevated' => isset($result['elevated']) ? $result['elevated'] : null,
522 522
                                 /// @todo decide what is the correct value for 'index': guid, installation_id/guid ?
523 523
                                 //'index' => isset($result['guid'])? $result['guid'] : null,
524 524
                             ]
@@ -559,9 +559,9 @@  discard block
 block discarded – undo
559 559
                     $results[$index] = new SearchHit(
560 560
                         [
561 561
                             'valueObject' => $result,
562
-                            'score' => isset($result['score'])? $result['score'] : null,
563
-                            'highlight' => isset($result['highlight'])? $result['highlight'] : null,
564
-                            'elevated' => isset($result['elevated'])? $result['elevated'] : null,
562
+                            'score' => isset($result['score']) ? $result['score'] : null,
563
+                            'highlight' => isset($result['highlight']) ? $result['highlight'] : null,
564
+                            'elevated' => isset($result['elevated']) ? $result['elevated'] : null,
565 565
                             /// @todo decide what is the correct value for 'index': guid, installation_id/guid ?
566 566
                             //'index' => isset($result['guid'])? $result['guid'] : null,
567 567
                         ]
Please login to merge, or discard this patch.
DependencyInjection/KaliopEzFindSearchEngineExtension.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 
14 14
     protected function loadInternal(array $mergedConfig, ContainerBuilder $container)
15 15
     {
16
-        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
16
+        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
17 17
         $loader->load('services.yml');
18 18
 
19 19
         if (self::$loadTestConfig != false) {
Please login to merge, or discard this patch.