Skip to content

Commit

Permalink
magento/magento2-jp/issues/18 : Provide possibility to customize anal…
Browse files Browse the repository at this point in the history
…yzer/tokenyzer for Elasticsearch

 - Fixed code style and minor issues to green static tests
  • Loading branch information
Volodymyr Kublytskyi committed Aug 10, 2018
1 parent 9281554 commit 2b5a50f
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private function convertTokenizer(\DOMNodeList $tokenizer): array
{
$tokenizerInfo = [];
foreach ($this->getItemNodes($tokenizer) as $node) {
$tokenizerInfo[$node->localName]= $this->convertConfigPart($node);
$tokenizerInfo[$node->localName] = $this->convertConfigPart($node);
}
return $tokenizerInfo;
}
Expand Down Expand Up @@ -127,7 +127,8 @@ private function getItemNodes(\DOMNodeList $nodeList): array
* @param \DOMNode $node
* @return mixed
*/
private function convertConfigPart(\DOMNode $node) {
private function convertConfigPart(\DOMNode $node)
{
$type = $this->detectConfigType($node);
switch ($type) {
case 'string':
Expand Down Expand Up @@ -270,8 +271,7 @@ private function convertMapNode(\DOMNode $node): array
private function elementChildNodes(\DOMNode $node)
{
foreach ($node->childNodes as $child) {
if (
$child->nodeType === XML_ELEMENT_NODE
if ($child->nodeType === XML_ELEMENT_NODE
&& strcasecmp($child->getAttribute('disabled'), 'true') !== 0
) {
yield $child;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Elasticsearch\Model\Adapter\Index\Config;

/**
Expand Down Expand Up @@ -51,4 +53,4 @@ public function getCharFiltersInfo(): array;
* @return array
*/
public function getCharFiltersList(): array;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Elasticsearch\Model\Adapter\Index\Config;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Elasticsearch\Model\Adapter\Index\Config;

/**
Expand All @@ -29,4 +31,4 @@ interface EsStemmerConfigInterface
* @return array
*/
public function getStemmerInfo();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Elasticsearch\Model\Adapter\Index\Config;

/**
Expand All @@ -26,4 +28,4 @@ interface EsStopWordsConfigInterface
* @return array
*/
public function getStopwordsInfo();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Elasticsearch\Model\Adapter\Index\Config;

/**
Expand Down Expand Up @@ -50,4 +52,4 @@ public function getTokenFiltersInfo(): array;
* @return array
*/
public function getTokenFiltersList(): array;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Elasticsearch\Model\Adapter\Index\Config;

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Elasticsearch/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="/magento2ce/lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Elasticsearch\Model\Adapter\FieldMapperInterface" type="Magento\Elasticsearch\Model\Adapter\FieldMapper\FieldMapperResolver" />
<type name="Magento\Elasticsearch\Model\Adapter\FieldMapper\FieldMapperResolver">
<arguments>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

use Magento\Framework\Component\ComponentRegistrar;

$registrar = new ComponentRegistrar();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

use Magento\Framework\Component\ComponentRegistrar;

$registrar = new ComponentRegistrar();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Elasticsearch\Model\Adapter\Index;

use Magento\Framework\Module\ModuleList;
Expand Down

0 comments on commit 2b5a50f

Please sign in to comment.