diff --git a/app/ProductModule/Command/ExportToElastic.php b/app/ProductModule/Command/ExportToElastic.php
index 3b2c895..3325722 100644
--- a/app/ProductModule/Command/ExportToElastic.php
+++ b/app/ProductModule/Command/ExportToElastic.php
@@ -16,9 +16,9 @@ class ExportToElastic extends \Symfony\Component\Console\Command\Command
private $delete;
/**
- * @var \App\ProductModule\Entity\SimpleProductConfig
+ * @var \App\ProductModule\Entity\WorkshopProductConfig
*/
- private $simpleProductConfig;
+ private $workshopProductConfig;
/**
* @var \Spameri\Elastic\Model\Indices\Create
@@ -30,14 +30,14 @@ public function __construct(
\App\ProductModule\Model\ExportToElastic $exportToElastic
, \Spameri\Elastic\Model\Indices\Delete $delete
, \Spameri\Elastic\Model\Indices\Create $create
- , \App\ProductModule\Entity\SimpleProductConfig $simpleProductConfig
+ , \App\ProductModule\Entity\WorkshopProductConfig $workshopProductConfig
)
{
parent::__construct(NULL);
$this->exportToElastic = $exportToElastic;
$this->delete = $delete;
$this->create = $create;
- $this->simpleProductConfig = $simpleProductConfig;
+ $this->workshopProductConfig = $workshopProductConfig;
}
@@ -56,13 +56,14 @@ public function execute(
// Clear index
try {
- $this->delete->execute($this->simpleProductConfig->provide()->indexName());
+ $this->delete->execute($this->workshopProductConfig->provide()->indexName());
+
} catch (\Spameri\Elastic\Exception\ElasticSearchException $exception) {}
// Create index
$this->create->execute(
- $this->simpleProductConfig->provide()->indexName(),
- $this->simpleProductConfig->provide()->toArray()
+ $this->workshopProductConfig->provide()->indexName(),
+ $this->workshopProductConfig->provide()->toArray()
);
// Export
diff --git a/app/ProductModule/Config/ProductModule.neon b/app/ProductModule/Config/ProductModule.neon
index f173596..b14ccdf 100644
--- a/app/ProductModule/Config/ProductModule.neon
+++ b/app/ProductModule/Config/ProductModule.neon
@@ -48,3 +48,23 @@ services:
simpleProductPrepareImportData:
class: App\ProductModule\Model\ExportToElastic\PrepareImportData
+### WorkshopProduct
+
+ workshopProductService:
+ factory: App\ProductModule\Model\WorkshopProductService
+ arguments:
+ - %spameriElasticSearch.entities.WorkshopProduct.index%
+ - @workshopProductFactory
+ - @workshopProductCollectionFactory
+
+ workshopProductConfig:
+ factory: App\ProductModule\Entity\WorkshopProductConfig
+ arguments:
+ - %spameriElasticSearch.entities.WorkshopProduct.index%
+
+ workshopProductFactory:
+ factory: App\ProductModule\Factory\WorkshopProductFactory
+
+ workshopProductCollectionFactory:
+ factory: App\ProductModule\Factory\WorkshopProductCollectionFactory
+
diff --git a/app/ProductModule/Config/WorkshopProduct.neon b/app/ProductModule/Config/WorkshopProduct.neon
new file mode 100644
index 0000000..101d5d3
--- /dev/null
+++ b/app/ProductModule/Config/WorkshopProduct.neon
@@ -0,0 +1,8 @@
+spameriElasticSearch:
+ entities:
+ WorkshopProduct:
+ index: workshop_product
+ dynamic: strict
+ config: @workshopProductConfig
+
+ properties:
diff --git a/app/ProductModule/ElasticQuery/SynonymAnalyzer.php b/app/ProductModule/ElasticQuery/SynonymAnalyzer.php
new file mode 100644
index 0000000..a80b3e8
--- /dev/null
+++ b/app/ProductModule/ElasticQuery/SynonymAnalyzer.php
@@ -0,0 +1,128 @@
+stopFilter = $stopFilter;
+ $this->synonym = $synonym;
+ }
+
+
+ public function name(): string
+ {
+ return 'czechSynonym';
+ }
+
+
+ public function filter(): \Spameri\ElasticQuery\Mapping\Settings\Analysis\FilterCollection
+ {
+ if ( ! $this->filter instanceof \Spameri\ElasticQuery\Mapping\Settings\Analysis\FilterCollection) {
+ $this->filter = new \Spameri\ElasticQuery\Mapping\Settings\Analysis\FilterCollection();
+ $this->filter->add(
+ new \Spameri\ElasticQuery\Mapping\Filter\Lowercase()
+ );
+ if ($this->stopFilter) {
+ $this->filter->add($this->stopFilter);
+
+ } else {
+ $this->filter->add(
+ new \Spameri\ElasticQuery\Mapping\Filter\Stop\Czech()
+ );
+ }
+ $this->filter->add(
+ new \Spameri\ElasticQuery\Mapping\Filter\Synonym(
+ $this->synonym
+ )
+ );
+ $this->filter->add(
+ new \Spameri\ElasticQuery\Mapping\Filter\Lowercase()
+ );
+ if ($this->stopFilter) {
+ $this->filter->add($this->stopFilter);
+
+ } else {
+ $this->filter->add(
+ new \Spameri\ElasticQuery\Mapping\Filter\Stop\Czech()
+ );
+ }
+ $this->filter->add(
+ new \Spameri\ElasticQuery\Mapping\Filter\Unique()
+ );
+ $this->filter->add(
+ new \Spameri\ElasticQuery\Mapping\Filter\ASCIIFolding()
+ );
+ }
+
+ return $this->filter;
+ }
+
+ public function key() : string
+ {
+ return $this->name();
+ }
+
+
+ public function getType() : string
+ {
+ return 'custom';
+ }
+
+
+ public function tokenizer() : string
+ {
+ return 'standard';
+ }
+
+
+ public function toArray() : array
+ {
+ $filterArray = [];
+ /** @var \Spameri\ElasticQuery\Mapping\FilterInterface $filter */
+ foreach ($this->filter() as $filter) {
+ if ($filter instanceof \Spameri\ElasticQuery\Mapping\Filter\Synonym) {
+ $filterArray[] = $filter->getName();
+
+ } elseif ($filter instanceof \Spameri\ElasticQuery\Mapping\Filter\Stop) {
+ $filterArray[] = $filter->getName();
+
+ } else {
+ $filterArray[] = $filter->getType();
+ }
+ }
+
+ return [
+ $this->name() => [
+ 'type' => $this->getType(),
+ 'tokenizer' => $this->tokenizer(),
+ 'filter' => $filterArray,
+ ],
+ ];
+ }
+
+
+}
diff --git a/app/ProductModule/Entity/Product.php b/app/ProductModule/Entity/Product.php
index 15ee01b..1cad173 100644
--- a/app/ProductModule/Entity/Product.php
+++ b/app/ProductModule/Entity/Product.php
@@ -3,11 +3,11 @@
namespace App\ProductModule\Entity;
-class Product implements \Spameri\Elastic\Entity\IElasticEntity
+class Product implements \Spameri\Elastic\Entity\ElasticEntityInterface
{
/**
- * @var \Spameri\Elastic\Entity\Property\IElasticId
+ * @var \Spameri\Elastic\Entity\Property\ElasticIdInterface
*/
private $id;
@@ -43,7 +43,7 @@ class Product implements \Spameri\Elastic\Entity\IElasticEntity
public function __construct(
- \Spameri\Elastic\Entity\Property\IElasticId $id
+ \Spameri\Elastic\Entity\Property\ElasticIdInterface $id
, \App\ProductModule\Entity\Product\IsPublic $isPublic
, \App\ProductModule\Entity\Product\Name $name
, \App\ProductModule\Entity\Product\Content $content
@@ -62,7 +62,7 @@ public function __construct(
}
- public function id(): \Spameri\Elastic\Entity\Property\IElasticId
+ public function id(): \Spameri\Elastic\Entity\Property\ElasticIdInterface
{
return $this->id;
}
diff --git a/app/ProductModule/Entity/Product/Content.php b/app/ProductModule/Entity/Product/Content.php
index 3235733..356c423 100644
--- a/app/ProductModule/Entity/Product/Content.php
+++ b/app/ProductModule/Entity/Product/Content.php
@@ -3,7 +3,7 @@
namespace App\ProductModule\Entity\Product;
-class Content implements \Spameri\Elastic\Entity\IValue
+class Content implements \Spameri\Elastic\Entity\ValueInterface
{
/**
diff --git a/app/ProductModule/Entity/Product/Details.php b/app/ProductModule/Entity/Product/Details.php
index e32eee5..958edca 100644
--- a/app/ProductModule/Entity/Product/Details.php
+++ b/app/ProductModule/Entity/Product/Details.php
@@ -3,7 +3,7 @@
namespace App\ProductModule\Entity\Product;
-class Details implements \Spameri\Elastic\Entity\IEntity
+class Details implements \Spameri\Elastic\Entity\EntityInterface
{
/**
diff --git a/app/ProductModule/Entity/Product/Details/Accessories.php b/app/ProductModule/Entity/Product/Details/Accessories.php
index e1748e3..efba31b 100644
--- a/app/ProductModule/Entity/Product/Details/Accessories.php
+++ b/app/ProductModule/Entity/Product/Details/Accessories.php
@@ -3,7 +3,7 @@
namespace App\ProductModule\Entity\Product\Details;
-class Accessories extends \Spameri\Elastic\Entity\Collection\ElasticEntityCollection
+class Accessories extends \Spameri\Elastic\Entity\Collection\AbstractElasticEntityCollection
{
}
diff --git a/app/ProductModule/Entity/Product/Details/Tag.php b/app/ProductModule/Entity/Product/Details/Tag.php
index c655230..ba73380 100644
--- a/app/ProductModule/Entity/Product/Details/Tag.php
+++ b/app/ProductModule/Entity/Product/Details/Tag.php
@@ -3,7 +3,7 @@
namespace App\ProductModule\Entity\Product\Details;
-class Tag implements \Spameri\Elastic\Entity\IValue
+class Tag implements \Spameri\Elastic\Entity\ValueInterface
{
/**
diff --git a/app/ProductModule/Entity/Product/Details/TagCollection.php b/app/ProductModule/Entity/Product/Details/TagCollection.php
index 0cd7e27..e83ef89 100644
--- a/app/ProductModule/Entity/Product/Details/TagCollection.php
+++ b/app/ProductModule/Entity/Product/Details/TagCollection.php
@@ -3,7 +3,7 @@
namespace App\ProductModule\Entity\Product\Details;
-class TagCollection implements \Spameri\Elastic\Entity\IValueCollection
+class TagCollection implements \Spameri\Elastic\Entity\ValueCollectionInterface
{
/**
diff --git a/app/ProductModule/Entity/Product/IsPublic.php b/app/ProductModule/Entity/Product/IsPublic.php
index a667672..c3fad0b 100644
--- a/app/ProductModule/Entity/Product/IsPublic.php
+++ b/app/ProductModule/Entity/Product/IsPublic.php
@@ -3,7 +3,7 @@
namespace App\ProductModule\Entity\Product;
-class IsPublic implements \Spameri\Elastic\Entity\IValue
+class IsPublic implements \Spameri\Elastic\Entity\ValueInterface
{
/**
diff --git a/app/ProductModule/Entity/Product/Name.php b/app/ProductModule/Entity/Product/Name.php
index c19b910..ec958cf 100644
--- a/app/ProductModule/Entity/Product/Name.php
+++ b/app/ProductModule/Entity/Product/Name.php
@@ -3,7 +3,7 @@
namespace App\ProductModule\Entity\Product;
-class Name implements \Spameri\Elastic\Entity\IValue
+class Name implements \Spameri\Elastic\Entity\ValueInterface
{
/**
diff --git a/app/ProductModule/Entity/Product/ParameterValue.php b/app/ProductModule/Entity/Product/ParameterValue.php
index b12beeb..42e21a8 100644
--- a/app/ProductModule/Entity/Product/ParameterValue.php
+++ b/app/ProductModule/Entity/Product/ParameterValue.php
@@ -3,7 +3,7 @@
namespace App\ProductModule\Entity\Product;
-class ParameterValue implements \Spameri\Elastic\Entity\IEntity
+class ParameterValue implements \Spameri\Elastic\Entity\EntityInterface
{
/**
diff --git a/app/ProductModule/Entity/Product/ParameterValuesCollection.php b/app/ProductModule/Entity/Product/ParameterValuesCollection.php
index 52378aa..eb5c3a2 100644
--- a/app/ProductModule/Entity/Product/ParameterValuesCollection.php
+++ b/app/ProductModule/Entity/Product/ParameterValuesCollection.php
@@ -3,7 +3,7 @@
namespace App\ProductModule\Entity\Product;
-class ParameterValuesCollection extends \Spameri\Elastic\Entity\Collection\EntityCollection
+class ParameterValuesCollection extends \Spameri\Elastic\Entity\Collection\AbstractEntityCollection
{
diff --git a/app/ProductModule/Entity/Product/Price.php b/app/ProductModule/Entity/Product/Price.php
index d378a0d..d849145 100644
--- a/app/ProductModule/Entity/Product/Price.php
+++ b/app/ProductModule/Entity/Product/Price.php
@@ -3,7 +3,7 @@
namespace App\ProductModule\Entity\Product;
-class Price implements \Spameri\Elastic\Entity\IValue
+class Price implements \Spameri\Elastic\Entity\ValueInterface
{
/**
diff --git a/app/ProductModule/Entity/ProductCollection.php b/app/ProductModule/Entity/ProductCollection.php
index 11f55e1..abd9005 100644
--- a/app/ProductModule/Entity/ProductCollection.php
+++ b/app/ProductModule/Entity/ProductCollection.php
@@ -3,7 +3,7 @@
namespace App\ProductModule\Entity;
-class ProductCollection extends \Spameri\Elastic\Entity\Collection\ElasticEntityCollection
+class ProductCollection extends \Spameri\Elastic\Entity\Collection\AbstractElasticEntityCollection
{
}
diff --git a/app/ProductModule/Entity/SimpleProduct.php b/app/ProductModule/Entity/SimpleProduct.php
index b332288..d38211d 100644
--- a/app/ProductModule/Entity/SimpleProduct.php
+++ b/app/ProductModule/Entity/SimpleProduct.php
@@ -2,11 +2,11 @@
namespace App\ProductModule\Entity;
-class SimpleProduct extends \Spameri\Elastic\Entity\AbstractImport implements \Spameri\Elastic\Entity\IElasticEntity
+class SimpleProduct extends \Spameri\Elastic\Entity\AbstractImport implements \Spameri\Elastic\Entity\ElasticEntityInterface
{
/**
- * @var \Spameri\Elastic\Entity\Property\IElasticId
+ * @var \Spameri\Elastic\Entity\Property\ElasticIdInterface
*/
private $id;
@@ -72,7 +72,7 @@ class SimpleProduct extends \Spameri\Elastic\Entity\AbstractImport implements \S
public function __construct(
- \Spameri\Elastic\Entity\Property\IElasticId $id,
+ \Spameri\Elastic\Entity\Property\ElasticIdInterface $id,
int $databaseId,
string $name,
?string $content,
@@ -103,7 +103,7 @@ public function __construct(
}
- public function id(): \Spameri\Elastic\Entity\Property\IElasticId
+ public function id(): \Spameri\Elastic\Entity\Property\ElasticIdInterface
{
return $this->id;
}
@@ -115,7 +115,7 @@ public function entityVariables(): array
}
- public function getId(): \Spameri\Elastic\Entity\Property\IElasticId
+ public function getId(): \Spameri\Elastic\Entity\Property\ElasticIdInterface
{
return $this->id;
}
diff --git a/app/ProductModule/Entity/SimpleProductConfig.php b/app/ProductModule/Entity/SimpleProductConfig.php
index 98cf1eb..7a16054 100644
--- a/app/ProductModule/Entity/SimpleProductConfig.php
+++ b/app/ProductModule/Entity/SimpleProductConfig.php
@@ -74,10 +74,14 @@ public function provide(): \Spameri\ElasticQuery\Mapping\Settings
);
$settings->addAnalyzer($edgeNgram);
- $worldSplit = new \Spameri\ElasticQuery\Mapping\Analyzer\Custom\WordDelimiter($stopFilter);
+ $worldSplit = new \Spameri\ElasticQuery\Mapping\Analyzer\Custom\WordDelimiter(
+ $stopFilter
+ );
$settings->addAnalyzer($worldSplit);
- $worldJoin = new \Spameri\ElasticQuery\Mapping\Analyzer\Custom\CommonGrams($stopWords);
+ $worldJoin = new \Spameri\ElasticQuery\Mapping\Analyzer\Custom\CommonGrams(
+ $stopWords
+ );
$settings->addAnalyzer($worldJoin);
// ===== FIELDS =====
diff --git a/app/ProductModule/Entity/WorkshopProduct.php b/app/ProductModule/Entity/WorkshopProduct.php
new file mode 100644
index 0000000..9ec4ae9
--- /dev/null
+++ b/app/ProductModule/Entity/WorkshopProduct.php
@@ -0,0 +1,196 @@
+id = $id;
+ $this->databaseId = $databaseId;
+ $this->name = $name;
+ $this->content = $content;
+ $this->alias = $alias;
+ $this->image = $image;
+ $this->price = $price;
+ $this->availability = $availability;
+ $this->tags = $tags;
+ $this->categories = $categories;
+ $this->purpose = $purpose;
+ $this->venality = $venality;
+ $this->brand = $brand;
+ }
+
+
+ public function id(): \Spameri\Elastic\Entity\Property\ElasticIdInterface
+ {
+ return $this->id;
+ }
+
+
+ public function entityVariables(): array
+ {
+ return \get_object_vars($this);
+ }
+
+
+ public function getId(): \Spameri\Elastic\Entity\Property\ElasticIdInterface
+ {
+ return $this->id;
+ }
+
+
+ public function getDatabaseId(): int
+ {
+ return $this->databaseId;
+ }
+
+
+ public function getName(): string
+ {
+ return $this->name;
+ }
+
+
+ public function getContent(): ?string
+ {
+ return $this->content;
+ }
+
+
+ public function getAlias(): string
+ {
+ return $this->alias;
+ }
+
+
+ public function getImage(): string
+ {
+ return $this->image;
+ }
+
+
+ public function getPrice(): float
+ {
+ return $this->price;
+ }
+
+
+ public function getAvailability(): string
+ {
+ return $this->availability;
+ }
+
+
+ public function getTags(): array
+ {
+ return $this->tags;
+ }
+
+
+ public function getCategories(): array
+ {
+ return $this->categories;
+ }
+
+
+ public function getPurpose(): array
+ {
+ return $this->purpose;
+ }
+
+
+ public function getVenality(): int
+ {
+ return $this->venality;
+ }
+
+
+ public function getBrand(): string
+ {
+ return $this->brand;
+ }
+
+}
diff --git a/app/ProductModule/Entity/WorkshopProductConfig.php b/app/ProductModule/Entity/WorkshopProductConfig.php
new file mode 100644
index 0000000..1ec10c9
--- /dev/null
+++ b/app/ProductModule/Entity/WorkshopProductConfig.php
@@ -0,0 +1,230 @@
+indexName = $indexName;
+ }
+
+
+ public function provide(): \Spameri\ElasticQuery\Mapping\Settings
+ {
+ $stopWords = [
+ 'angin',
+ 'ml',
+ 'l',
+ 'litr',
+ 'litry',
+ 'litrů',
+ 'ks',
+ 'pastilka',
+ 'pastilky',
+ 'pastilek',
+ 'kapsle',
+ 'kapslí',
+ 'tbl',
+ 'tob',
+ 'dr',
+ 'cps',
+ 'x',
+ 'g',
+ 'mg',
+ 'báze',
+ 'bázi',
+ 'e',
+ 'dp',
+ 'duo',
+ 'v',
+ 'a',
+ 'plus',
+ 'por',
+ 'nob',
+ 'zn',
+ 'la',
+ 'lr',
+ 'b6',
+ 'n',
+ ];
+ $settings = new \Spameri\ElasticQuery\Mapping\Settings($this->indexName);
+ $stopFilter = new \Spameri\ElasticQuery\Mapping\Filter\Stop\Czech($stopWords);
+ $czechDictionary = new \Spameri\ElasticQuery\Mapping\Analyzer\Custom\CzechDictionary(
+ $stopFilter
+ );
+ $settings->addAnalyzer($czechDictionary);
+
+ $lowercase = new \Spameri\ElasticQuery\Mapping\Analyzer\Custom\Lowercase();
+ $settings->addAnalyzer($lowercase);
+
+ $edgeNgram = new \Spameri\ElasticQuery\Mapping\Analyzer\Custom\EdgeNgram(
+ 2,
+ 6,
+ $stopFilter
+ );
+ $settings->addAnalyzer($edgeNgram);
+
+ $wordSplit = new \Spameri\ElasticQuery\Mapping\Analyzer\Custom\WordDelimiter();
+ $settings->addAnalyzer($wordSplit);
+
+ $wordJoin = new \Spameri\ElasticQuery\Mapping\Analyzer\Custom\CommonGrams(
+ $stopWords
+ );
+ $settings->addAnalyzer($wordJoin);
+
+ $synonym = new \App\ProductModule\ElasticQuery\SynonymAnalyzer(
+ $stopFilter,
+ [
+ 'paralen => kaše',
+ ]
+ );
+ $settings->addAnalyzer($synonym);
+
+
+ // =========== FIELDS
+
+ $settings->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'databaseId',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_KEYWORD
+ )
+ );
+
+ $nameFields = new \Spameri\ElasticQuery\Mapping\Settings\Mapping\SubFields(
+ 'name',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT
+ );
+
+ $nameFields->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'czechDictionary',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT,
+ $czechDictionary
+ )
+ );
+ $nameFields->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'edgeNgram',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT,
+ $edgeNgram
+ )
+ );
+ $nameFields->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'wordSplit',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT,
+ $wordSplit
+ )
+ );
+ $nameFields->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'wordJoin',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT,
+ $wordJoin
+ )
+ );
+ $nameFields->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'czechSynonym',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT,
+ $synonym
+ )
+ );
+
+ $settings->addMappingSubField($nameFields);
+
+ $settings->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'content',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT,
+ $czechDictionary
+ )
+ );
+
+ $settings->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'alias',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_KEYWORD
+ )
+ );
+
+ $settings->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'image',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_KEYWORD
+ )
+ );
+
+ $settings->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'price',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_DOUBLE
+ )
+ );
+
+ $settings->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'availability',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT,
+ $lowercase,
+ TRUE
+ )
+ );
+
+ $settings->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'tags',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT,
+ $lowercase,
+ TRUE
+ )
+ );
+
+ $settings->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'categories',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT,
+ $lowercase,
+ TRUE
+ )
+ );
+
+ $settings->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'purpose',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT,
+ $lowercase,
+ TRUE
+ )
+ );
+
+ $settings->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'venality',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_INTEGER
+ )
+ );
+
+ $settings->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'brand',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT,
+ $lowercase,
+ TRUE
+ )
+ );
+
+ return $settings;
+ }
+
+}
diff --git a/app/ProductModule/Factory/ProductCollectionFactory.php b/app/ProductModule/Factory/ProductCollectionFactory.php
index a9c9de5..1d194b5 100644
--- a/app/ProductModule/Factory/ProductCollectionFactory.php
+++ b/app/ProductModule/Factory/ProductCollectionFactory.php
@@ -3,14 +3,14 @@
namespace App\ProductModule\Factory;
-class ProductCollectionFactory implements \Spameri\Elastic\Factory\ICollectionFactory
+class ProductCollectionFactory implements \Spameri\Elastic\Factory\CollectionFactoryInterface
{
public function create(
- \Spameri\Elastic\Model\IService $service
+ \Spameri\Elastic\Model\ServiceInterface $service
, array $elasticIds = []
- , \Spameri\Elastic\Entity\IElasticEntity ... $entityCollection
- ) : \Spameri\Elastic\Entity\IElasticEntityCollection
+ , \Spameri\Elastic\Entity\ElasticEntityInterface ... $entityCollection
+ ) : \Spameri\Elastic\Entity\ElasticEntityCollectionInterface
{
return new \App\ProductModule\Entity\ProductCollection($service, $elasticIds, ... $entityCollection);
}
diff --git a/app/ProductModule/Factory/ProductFactory.php b/app/ProductModule/Factory/ProductFactory.php
index a47b46b..e49a73f 100644
--- a/app/ProductModule/Factory/ProductFactory.php
+++ b/app/ProductModule/Factory/ProductFactory.php
@@ -3,7 +3,7 @@
namespace App\ProductModule\Factory;
-class ProductFactory implements \Spameri\Elastic\Factory\IEntityFactory
+class ProductFactory implements \Spameri\Elastic\Factory\EntityFactoryInterface
{
/**
diff --git a/app/ProductModule/Factory/SimpleProductCollectionFactory.php b/app/ProductModule/Factory/SimpleProductCollectionFactory.php
index 9be8c6a..c8a1f4a 100644
--- a/app/ProductModule/Factory/SimpleProductCollectionFactory.php
+++ b/app/ProductModule/Factory/SimpleProductCollectionFactory.php
@@ -3,14 +3,14 @@
namespace App\ProductModule\Factory;
-class SimpleProductCollectionFactory implements \Spameri\Elastic\Factory\ICollectionFactory
+class SimpleProductCollectionFactory implements \Spameri\Elastic\Factory\CollectionFactoryInterface
{
public function create(
- \Spameri\Elastic\Model\IService $service
+ \Spameri\Elastic\Model\ServiceInterface $service
, array $elasticIds = []
- , \Spameri\Elastic\Entity\IElasticEntity ... $entityCollection
- ) : \Spameri\Elastic\Entity\IElasticEntityCollection
+ , \Spameri\Elastic\Entity\ElasticEntityInterface ... $entityCollection
+ ) : \Spameri\Elastic\Entity\ElasticEntityCollectionInterface
{
return new \App\ProductModule\Entity\ProductCollection($service, $elasticIds, ... $entityCollection);
}
diff --git a/app/ProductModule/Factory/SimpleProductFactory.php b/app/ProductModule/Factory/SimpleProductFactory.php
index 6d1c05d..433358d 100644
--- a/app/ProductModule/Factory/SimpleProductFactory.php
+++ b/app/ProductModule/Factory/SimpleProductFactory.php
@@ -3,7 +3,7 @@
namespace App\ProductModule\Factory;
-class SimpleProductFactory implements \Spameri\Elastic\Factory\IEntityFactory
+class SimpleProductFactory implements \Spameri\Elastic\Factory\EntityFactoryInterface
{
public function create(\Spameri\ElasticQuery\Response\Result\Hit $hit) : \Generator
diff --git a/app/ProductModule/Factory/WorkshopProductCollectionFactory.php b/app/ProductModule/Factory/WorkshopProductCollectionFactory.php
new file mode 100644
index 0000000..b2dcbff
--- /dev/null
+++ b/app/ProductModule/Factory/WorkshopProductCollectionFactory.php
@@ -0,0 +1,22 @@
+id()),
+ $hit->getValue('databaseId'),
+ $hit->getValue('name'),
+ $hit->getValue('content'),
+ $hit->getValue('alias'),
+ $hit->getValue('image'),
+ $hit->getValue('price'),
+ $hit->getValue('availability'),
+ $hit->getValue('tags'),
+ $hit->getValue('categories'),
+ $hit->getValue('purpose'),
+ $hit->getValue('venality'),
+ $hit->getValue('brand')
+ );
+ }
+
+}
diff --git a/app/ProductModule/Model/ExportToElastic/DataImport.php b/app/ProductModule/Model/ExportToElastic/DataImport.php
index 2a187ea..1b47b92 100644
--- a/app/ProductModule/Model/ExportToElastic/DataImport.php
+++ b/app/ProductModule/Model/ExportToElastic/DataImport.php
@@ -6,27 +6,27 @@ class DataImport implements \Spameri\Elastic\Import\DataImportInterface
{
/**
- * @var \App\ProductModule\Model\SimpleProductService
+ * @var \App\ProductModule\Model\WorkshopProductService
*/
- private $productService;
+ private $workshopProductService;
public function __construct(
- \App\ProductModule\Model\SimpleProductService $productService
+ \App\ProductModule\Model\WorkshopProductService $workshopProductService
)
{
- $this->productService = $productService;
+ $this->workshopProductService = $workshopProductService;
}
/**
- * @param \App\ProductModule\Entity\SimpleProduct $entity
+ * @param \App\ProductModule\Entity\WorkshopProduct $entity
*/
public function import(
\Spameri\Elastic\Entity\AbstractImport $entity
): \Spameri\Elastic\Import\ResponseInterface
{
- $id = $this->productService->insert($entity);
+ $id = $this->workshopProductService->insert($entity);
return new \Spameri\Elastic\Import\Response\SimpleResponse(
$id,
diff --git a/app/ProductModule/Model/ExportToElastic/PrepareImportData.php b/app/ProductModule/Model/ExportToElastic/PrepareImportData.php
index 0b92d61..65bc845 100644
--- a/app/ProductModule/Model/ExportToElastic/PrepareImportData.php
+++ b/app/ProductModule/Model/ExportToElastic/PrepareImportData.php
@@ -32,7 +32,7 @@ public function prepare($entityData): \Spameri\Elastic\Entity\AbstractImport
$existingProduct = $this->simpleProductService->getBy($query);
$elasticId = $existingProduct->id();
- } catch (\Spameri\Elastic\Exception\ElasticSearchException $exception) {
+ } catch (\Spameri\Elastic\Exception\AbstractElasticSearchException $exception) {
$elasticId = new \Spameri\Elastic\Entity\Property\EmptyElasticId();
}
@@ -58,7 +58,7 @@ public function prepare($entityData): \Spameri\Elastic\Entity\AbstractImport
$categories[] = \array_rand(\array_flip(Categories::VALUES));
$categories[] = \array_rand(\array_flip(Categories::VALUES));
- return new \App\ProductModule\Entity\SimpleProduct(
+ return new \App\ProductModule\Entity\WorkshopProduct(
$elasticId,
(int) $entityData['id'],
$entityData['name'],
@@ -70,7 +70,7 @@ public function prepare($entityData): \Spameri\Elastic\Entity\AbstractImport
$tags,
$categories,
$purpose,
- 0,
+ \random_int(0, 1000),
$brand
);
}
diff --git a/app/ProductModule/Model/ProductService.php b/app/ProductModule/Model/ProductService.php
index 8e05138..3da148f 100644
--- a/app/ProductModule/Model/ProductService.php
+++ b/app/ProductModule/Model/ProductService.php
@@ -3,15 +3,15 @@
namespace App\ProductModule\Model;
-class ProductService extends \Spameri\Elastic\Model\BaseService
+class ProductService extends \Spameri\Elastic\Model\AbstractBaseService
{
/**
- * @param \Spameri\Elastic\Entity\IElasticEntity|\App\ProductModule\Entity\Product $entity
+ * @param \Spameri\Elastic\Entity\ElasticEntityInterface|\App\ProductModule\Entity\Product $entity
* @return string
*/
public function insert(
- \Spameri\Elastic\Entity\IElasticEntity $entity
+ \Spameri\Elastic\Entity\ElasticEntityInterface $entity
) : string
{
return parent::insert($entity);
@@ -20,12 +20,12 @@ public function insert(
/**
* @param \Spameri\Elastic\Entity\Property\ElasticId $id
- * @return \Spameri\Elastic\Entity\IElasticEntity|\App\ProductModule\Entity\Product
+ * @return \Spameri\Elastic\Entity\ElasticEntityInterface|\App\ProductModule\Entity\Product
* @throws \Spameri\Elastic\Exception\DocumentNotFound
*/
public function get(
\Spameri\Elastic\Entity\Property\ElasticId $id
- ) : \Spameri\Elastic\Entity\IElasticEntity
+ ) : \Spameri\Elastic\Entity\ElasticEntityInterface
{
return parent::get($id);
}
@@ -33,12 +33,12 @@ public function get(
/**
* @param \Spameri\ElasticQuery\ElasticQuery $elasticQuery
- * @return \Spameri\Elastic\Entity\IElasticEntity|\App\ProductModule\Entity\Product
+ * @return \Spameri\Elastic\Entity\ElasticEntityInterface|\App\ProductModule\Entity\Product
* @throws \Spameri\Elastic\Exception\DocumentNotFound
*/
public function getBy(
\Spameri\ElasticQuery\ElasticQuery $elasticQuery
- ) : \Spameri\Elastic\Entity\IElasticEntity
+ ) : \Spameri\Elastic\Entity\ElasticEntityInterface
{
return parent::getBy($elasticQuery);
}
@@ -50,7 +50,7 @@ public function getBy(
* @throws \Spameri\Elastic\Exception\DocumentNotFound
*/
public function getAllBy(\Spameri\ElasticQuery\ElasticQuery $elasticQuery
- ) : \Spameri\Elastic\Entity\IElasticEntityCollection
+ ) : \Spameri\Elastic\Entity\ElasticEntityCollectionInterface
{
return parent::getAllBy($elasticQuery);
}
diff --git a/app/ProductModule/Model/SimpleProductService.php b/app/ProductModule/Model/SimpleProductService.php
index 86b83b0..28df6dc 100644
--- a/app/ProductModule/Model/SimpleProductService.php
+++ b/app/ProductModule/Model/SimpleProductService.php
@@ -3,7 +3,7 @@
namespace App\ProductModule\Model;
-class SimpleProductService extends \Spameri\Elastic\Model\BaseService
+class SimpleProductService extends \Spameri\Elastic\Model\AbstractBaseService
{
}
diff --git a/app/ProductModule/Model/WorkshopProductService.php b/app/ProductModule/Model/WorkshopProductService.php
new file mode 100644
index 0000000..bb2eb37
--- /dev/null
+++ b/app/ProductModule/Model/WorkshopProductService.php
@@ -0,0 +1,17 @@
+productService->getAllBy($query);
- } catch (\Spameri\Elastic\Exception\ElasticSearchException $exception) {
+ } catch (\Spameri\Elastic\Exception\AbstractElasticSearchException $exception) {
$products = [];
}
diff --git a/app/ProductModule/Presenter/StepFourPresenter.php b/app/ProductModule/Presenter/StepFourPresenter.php
index 2276ec8..1f4f4de 100644
--- a/app/ProductModule/Presenter/StepFourPresenter.php
+++ b/app/ProductModule/Presenter/StepFourPresenter.php
@@ -27,7 +27,7 @@ public function renderDefault($queryString): void
try {
$products = $this->productService->getAllBy($query);
- } catch (\Spameri\Elastic\Exception\ElasticSearchException $exception) {
+ } catch (\Spameri\Elastic\Exception\AbstractElasticSearchException $exception) {
$products = [];
}
diff --git a/app/ProductModule/Presenter/StepOnePresenter.php b/app/ProductModule/Presenter/StepOnePresenter.php
index 1eedff1..b5f3e9e 100644
--- a/app/ProductModule/Presenter/StepOnePresenter.php
+++ b/app/ProductModule/Presenter/StepOnePresenter.php
@@ -27,7 +27,7 @@ public function renderDefault($queryString): void
try {
$products = $this->productService->getAllBy($query);
- } catch (\Spameri\Elastic\Exception\ElasticSearchException $exception) {
+ } catch (\Spameri\Elastic\Exception\AbstractElasticSearchException $exception) {
$products = [];
\Tracy\Debugger::barDump($exception);
}
diff --git a/app/ProductModule/Presenter/StepSixPresenter.php b/app/ProductModule/Presenter/StepSixPresenter.php
index d8f907d..61c109b 100644
--- a/app/ProductModule/Presenter/StepSixPresenter.php
+++ b/app/ProductModule/Presenter/StepSixPresenter.php
@@ -27,7 +27,7 @@ public function renderDefault($queryString): void
try {
$products = $this->productService->getAllBy($query);
- } catch (\Spameri\Elastic\Exception\ElasticSearchException $exception) {
+ } catch (\Spameri\Elastic\Exception\AbstractElasticSearchException $exception) {
$products = [];
}
diff --git a/app/ProductModule/Presenter/StepThreePresenter.php b/app/ProductModule/Presenter/StepThreePresenter.php
index d3158e4..69da810 100644
--- a/app/ProductModule/Presenter/StepThreePresenter.php
+++ b/app/ProductModule/Presenter/StepThreePresenter.php
@@ -26,7 +26,7 @@ public function renderDefault($queryString): void
try {
$products = $this->productService->getAllBy($query);
- } catch (\Spameri\Elastic\Exception\ElasticSearchException $exception) {
+ } catch (\Spameri\Elastic\Exception\AbstractElasticSearchException $exception) {
$products = [];
}
diff --git a/app/ProductModule/Presenter/StepTwoPresenter.php b/app/ProductModule/Presenter/StepTwoPresenter.php
index 1ec5479..9e92d3f 100644
--- a/app/ProductModule/Presenter/StepTwoPresenter.php
+++ b/app/ProductModule/Presenter/StepTwoPresenter.php
@@ -27,7 +27,7 @@ public function renderDefault($queryString): void
try {
$products = $this->productService->getAllBy($query);
- } catch (\Spameri\Elastic\Exception\ElasticSearchException $exception) {
+ } catch (\Spameri\Elastic\Exception\AbstractElasticSearchException $exception) {
$products = [];
}
diff --git a/app/ProductModule/Presenter/WorkshopPresenter.php b/app/ProductModule/Presenter/WorkshopPresenter.php
new file mode 100644
index 0000000..0a126c8
--- /dev/null
+++ b/app/ProductModule/Presenter/WorkshopPresenter.php
@@ -0,0 +1,190 @@
+productService = $productService;
+ }
+
+
+ public function renderDefault($queryString): void
+ {
+ $query = $this->buildQuery($queryString);
+
+ try {
+ $products = $this->productService->getAllBy($query);
+
+ } catch (\Spameri\Elastic\Exception\AbstractElasticSearchException $exception) {
+ $products = [];
+ }
+
+ $this->getTemplate()->add(
+ 'products',
+ $products
+ );
+ $this->getTemplate()->add(
+ 'queryString',
+ $queryString
+ );
+ }
+
+
+ public function createComponentSearchForm() :\Nette\Application\UI\Form
+ {
+ $form = new \Nette\Application\UI\Form();
+ $form->addText('queryString', 'query')
+ ->setAttribute('class', 'inp-text suggest')
+ ;
+
+ $form->addSubmit('search', 'Search');
+
+ $form->onSuccess[] = function () use ($form) {
+ $this->redirect(
+ 301,
+ ':Product:Workshop:default',
+ [
+ 'queryString' => $form->getValues()->queryString,
+ ]
+ );
+ };
+
+ return $form;
+ }
+
+
+ public function buildQuery(?string $queryString): \Spameri\ElasticQuery\ElasticQuery
+ {
+ $query = new \Spameri\ElasticQuery\ElasticQuery();
+ $shouldCollection = new \Spameri\ElasticQuery\Query\ShouldCollection();
+ $mustCollection = new \Spameri\ElasticQuery\Query\MustCollection();
+ $mustNotCollection = new \Spameri\ElasticQuery\Query\MustNotCollection();
+
+ $mustCollection->add(
+ new \Spameri\ElasticQuery\Query\MultiMatch(
+ [
+ 'name.czechDictionary',
+ 'name.edgeNgram',
+ 'name.wordSplit',
+ 'name.wordJoin',
+ 'name.czechSynonym',
+ ],
+ $queryString,
+ 3,
+ \Spameri\ElasticQuery\Query\Match\MultiMatchType::BEST_FIELDS,
+ \Spameri\ElasticQuery\Query\Match\Operator::OR,
+ new \Spameri\ElasticQuery\Query\Match\Fuzziness(
+ \Spameri\ElasticQuery\Query\Match\Fuzziness::AUTO
+ ),
+ 'czechDictionary'
+ )
+ );
+
+ // ===============
+
+ $mustCollection->add(
+ new \Spameri\ElasticQuery\Query\Term(
+ 'availability',
+ 'skladem'
+ )
+ );
+
+ $mustCollection->add(
+ new \Spameri\ElasticQuery\Query\Range(
+ 'price',
+ 1
+ )
+ );
+
+ $mustCollection->add(
+ new \Spameri\ElasticQuery\Query\Exists('image')
+ );
+
+ $query->addMustQuery(
+ new \Spameri\ElasticQuery\Query\QueryCollection(
+ $mustCollection,
+ $shouldCollection,
+ $mustNotCollection
+ )
+ );
+
+ $query->options()->changeSize(20);
+
+
+ // =========== AGGS
+
+
+ $query->addAggregation(
+ new \Spameri\ElasticQuery\Aggregation\LeafAggregationCollection(
+ 'price',
+ NULL,
+ new \Spameri\ElasticQuery\Aggregation\Range(
+ 'price',
+ TRUE,
+ new \Spameri\ElasticQuery\Aggregation\RangeValueCollection(
+ new \Spameri\ElasticQuery\Aggregation\RangeValue(
+ '0 - 50 Kč',
+ 0,
+ 50
+ ),
+ new \Spameri\ElasticQuery\Aggregation\RangeValue('50 - 100 Kč', 50, 100),
+ new \Spameri\ElasticQuery\Aggregation\RangeValue('100 - 200 Kč', 100, 200),
+ new \Spameri\ElasticQuery\Aggregation\RangeValue('200 - 500 Kč', 200, 500),
+ new \Spameri\ElasticQuery\Aggregation\RangeValue('500 - 1000 Kč', 500, 1000)
+ )
+ )
+ )
+ );
+
+
+ $priceFrom = $this->getParameter('priceFrom');
+ $this->template->add('priceFrom', $priceFrom);
+ $priceTo = $this->getParameter('priceTo');
+ $filter = new \Spameri\ElasticQuery\Filter\FilterCollection();
+ if ($priceFrom !== NULL && $priceTo !== NULL ) {
+ $filter->must()->add(
+ new \Spameri\ElasticQuery\Query\Range(
+ 'price',
+ $priceFrom,
+ $priceTo
+ )
+ );
+ }
+ $query->addAggregation(
+ new \Spameri\ElasticQuery\Aggregation\LeafAggregationCollection(
+ 'categories',
+ $filter,
+ new \Spameri\ElasticQuery\Aggregation\Term(
+ 'categories',
+ 100
+ )
+ )
+ );
+
+ $query->addAggregation(
+ new \Spameri\ElasticQuery\Aggregation\LeafAggregationCollection(
+ 'brands',
+ NULL,
+ new \Spameri\ElasticQuery\Aggregation\Term(
+ 'brand',
+ 1000
+ )
+ )
+ );
+
+ return $query;
+ }
+
+}
diff --git a/app/ProductModule/templates/Workshop/default.latte b/app/ProductModule/templates/Workshop/default.latte
new file mode 100644
index 0000000..40b7d0b
--- /dev/null
+++ b/app/ProductModule/templates/Workshop/default.latte
@@ -0,0 +1,110 @@
+{block content}
+
+
Workshop
+
+
+
+ {form searchForm}
+
+ {/form}
+
You have searched: {$queryString}
+
+
+
+
+
+ {foreach $products as $product}
+
+
+
+ {/foreach}
+
+
+
+{/block}
diff --git a/app/WorkshopThreeModule/DDD/Domain/Addon/Addon.php b/app/WorkshopThreeModule/DDD/Domain/Addon/Addon.php
new file mode 100644
index 0000000..0f64e47
--- /dev/null
+++ b/app/WorkshopThreeModule/DDD/Domain/Addon/Addon.php
@@ -0,0 +1,13 @@
+organizationRepository = $organizationRepository;
+ }
+
+
+ public function availableAddonByTier(int $tier): \DDD\Domain\Addon\Addon
+ {
+ $data = $this->nodeMagicApi->fetchIdbyTier($tier);
+
+ $organization = $this->organizationRepository->getByAddonId($data['id']);
+
+ return new \DDD\Domain\Addon\Addon(
+ $data['id'],
+ $organization
+ );
+ }
+
+}
diff --git a/app/WorkshopThreeModule/DDD/Infrastructure/Organization/OrganizationFormRepositoryFromForm.php b/app/WorkshopThreeModule/DDD/Infrastructure/Organization/OrganizationFormRepositoryFromForm.php
new file mode 100644
index 0000000..2e5c521
--- /dev/null
+++ b/app/WorkshopThreeModule/DDD/Infrastructure/Organization/OrganizationFormRepositoryFromForm.php
@@ -0,0 +1,19 @@
+netteFormData;
+
+ return new \DDD\Domain\Organization\Organization(
+ $data['id'],
+ $data['name'],
+ $data['package'],
+ );
+ }
+
+}
diff --git a/app/WorkshopThreeModule/DDD/Infrastructure/Organization/OrganizationNodeRepository.php b/app/WorkshopThreeModule/DDD/Infrastructure/Organization/OrganizationNodeRepository.php
new file mode 100644
index 0000000..a622a26
--- /dev/null
+++ b/app/WorkshopThreeModule/DDD/Infrastructure/Organization/OrganizationNodeRepository.php
@@ -0,0 +1,19 @@
+nodeMagicApi->fetchbyAddonId($id);
+
+ return new \DDD\Domain\Organization\Organization(
+ $data['id'],
+ $data['name'],
+ $data['package'],
+ );
+ }
+
+}
diff --git a/app/WorkshopThreeModule/Nette/AddonModule/Addon.php b/app/WorkshopThreeModule/Nette/AddonModule/Addon.php
new file mode 100644
index 0000000..0f64e47
--- /dev/null
+++ b/app/WorkshopThreeModule/Nette/AddonModule/Addon.php
@@ -0,0 +1,13 @@
+organizationRepository = $organizationRepository;
+ }
+
+
+ public function availableAddonByTier(int $tier): \DDD\Domain\Addon\Addon
+ {
+ $data = $this->nodeMagicApi->fetchIdbyTier($tier);
+
+ $organization = $this->organizationRepository->getByAddonId($data['id']);
+
+ return new \DDD\Domain\Addon\Addon(
+ $data['id'],
+ $organization
+ );
+ }
+
+}
diff --git a/app/WorkshopThreeModule/Nette/AddonModule/Addon/AddonRepository.php b/app/WorkshopThreeModule/Nette/AddonModule/Addon/AddonRepository.php
new file mode 100644
index 0000000..68cc964
--- /dev/null
+++ b/app/WorkshopThreeModule/Nette/AddonModule/Addon/AddonRepository.php
@@ -0,0 +1,10 @@
+addonRepository = $addonRepository;
+ }
+
+
+ public function renderDefault($tier)
+ {
+ $this->template->addon = $this->addonRepository->availableAddonByTier($tier);
+ }
+
+}
diff --git a/app/WorkshopThreeModule/Nette/AddonModule/UI/Front/Presenter/AddonPresenter.php b/app/WorkshopThreeModule/Nette/AddonModule/UI/Front/Presenter/AddonPresenter.php
new file mode 100644
index 0000000..c4c0198
--- /dev/null
+++ b/app/WorkshopThreeModule/Nette/AddonModule/UI/Front/Presenter/AddonPresenter.php
@@ -0,0 +1,25 @@
+addonRepository = $addonRepository;
+ }
+
+
+ public function renderDefault($tier)
+ {
+ $this->template->addon = $this->addonRepository->availableAddonByTier($tier);
+ }
+
+}
diff --git a/app/WorkshopThreeModule/Nette/OrganizationModule/Organization.php b/app/WorkshopThreeModule/Nette/OrganizationModule/Organization.php
new file mode 100644
index 0000000..7f8ef21
--- /dev/null
+++ b/app/WorkshopThreeModule/Nette/OrganizationModule/Organization.php
@@ -0,0 +1,14 @@
+netteFormData;
+
+ return new \DDD\Domain\Organization\Organization(
+ $data['id'],
+ $data['name'],
+ $data['package'],
+ );
+ }
+
+}
diff --git a/app/WorkshopThreeModule/Nette/OrganizationModule/Organization/OrganizationNodeRepository.php b/app/WorkshopThreeModule/Nette/OrganizationModule/Organization/OrganizationNodeRepository.php
new file mode 100644
index 0000000..a622a26
--- /dev/null
+++ b/app/WorkshopThreeModule/Nette/OrganizationModule/Organization/OrganizationNodeRepository.php
@@ -0,0 +1,19 @@
+nodeMagicApi->fetchbyAddonId($id);
+
+ return new \DDD\Domain\Organization\Organization(
+ $data['id'],
+ $data['name'],
+ $data['package'],
+ );
+ }
+
+}
diff --git a/app/WorkshopThreeModule/Nette/OrganizationModule/Organization/OrganizationRepository.php b/app/WorkshopThreeModule/Nette/OrganizationModule/Organization/OrganizationRepository.php
new file mode 100644
index 0000000..476ae50
--- /dev/null
+++ b/app/WorkshopThreeModule/Nette/OrganizationModule/Organization/OrganizationRepository.php
@@ -0,0 +1,10 @@
+organizationRepository = $organizationRepository;
+ }
+
+
+ public function availableAddonByTier(int $tier): \DDD\Domain\Addon\Addon
+ {
+ $data = $this->nodeMagicApi->fetchIdbyTier($tier);
+
+ $organization = $this->organizationRepository->getByAddonId($data['id']);
+
+ return new \DDD\Domain\Addon\Addon(
+ $data['id'],
+ $organization
+ );
+ }
+
+}
diff --git a/app/WorkshopThreeModule/PD2/Pd6/LangModule/Domain/Addon/AddonRepository.php b/app/WorkshopThreeModule/PD2/Pd6/LangModule/Domain/Addon/AddonRepository.php
new file mode 100644
index 0000000..68cc964
--- /dev/null
+++ b/app/WorkshopThreeModule/PD2/Pd6/LangModule/Domain/Addon/AddonRepository.php
@@ -0,0 +1,10 @@
+addonRepository = $addonRepository;
+ }
+
+
+ public function renderDefault($tier)
+ {
+ $this->template->addon = $this->addonRepository->availableAddonByTier($tier);
+ }
+
+}
diff --git a/app/WorkshopThreeModule/PD2/Pd6/LangModule/UI/Front/Presenter/AddonPresenter.php b/app/WorkshopThreeModule/PD2/Pd6/LangModule/UI/Front/Presenter/AddonPresenter.php
new file mode 100644
index 0000000..c4c0198
--- /dev/null
+++ b/app/WorkshopThreeModule/PD2/Pd6/LangModule/UI/Front/Presenter/AddonPresenter.php
@@ -0,0 +1,25 @@
+addonRepository = $addonRepository;
+ }
+
+
+ public function renderDefault($tier)
+ {
+ $this->template->addon = $this->addonRepository->availableAddonByTier($tier);
+ }
+
+}
diff --git a/app/WorkshopThreeModule/PD2/Pd6/PageModule/Api/AddonApi.php b/app/WorkshopThreeModule/PD2/Pd6/PageModule/Api/AddonApi.php
new file mode 100644
index 0000000..29c6a8b
--- /dev/null
+++ b/app/WorkshopThreeModule/PD2/Pd6/PageModule/Api/AddonApi.php
@@ -0,0 +1,8 @@
+addonRepository = $addonRepository;
+ }
+
+
+ public function renderDefault($tier)
+ {
+ $this->template->addon = $this->addonRepository->availableAddonByTier($tier);
+ }
+
+}
diff --git a/app/WorkshopThreeModule/PD2/Pd6/PageModule/UI/Front/Presenter/AddonPresenter.php b/app/WorkshopThreeModule/PD2/Pd6/PageModule/UI/Front/Presenter/AddonPresenter.php
new file mode 100644
index 0000000..c4c0198
--- /dev/null
+++ b/app/WorkshopThreeModule/PD2/Pd6/PageModule/UI/Front/Presenter/AddonPresenter.php
@@ -0,0 +1,25 @@
+addonRepository = $addonRepository;
+ }
+
+
+ public function renderDefault($tier)
+ {
+ $this->template->addon = $this->addonRepository->availableAddonByTier($tier);
+ }
+
+}
diff --git a/app/WorkshopThreeModule/PD2/libs/Collection/EntityCollection.php b/app/WorkshopThreeModule/PD2/libs/Collection/EntityCollection.php
new file mode 100644
index 0000000..a10564c
--- /dev/null
+++ b/app/WorkshopThreeModule/PD2/libs/Collection/EntityCollection.php
@@ -0,0 +1,8 @@
+addonRepository = $addonRepository;
+ }
+
+
+ public function renderDefault($tier)
+ {
+ $this->template->addon = $this->addonRepository->availableAddonByTier($tier);
+ }
+
+}
diff --git a/app/WorkshopThreeModule/readme.md b/app/WorkshopThreeModule/readme.md
new file mode 100644
index 0000000..238b159
--- /dev/null
+++ b/app/WorkshopThreeModule/readme.md
@@ -0,0 +1,6 @@
+Domácí úkoly
+
+1. Seznam aktuálních výstupů
+2. Seznam předpokládaných výstupů
+3. Zvolit uložení do stávajícího systému
+4. Namodelovat konkrétní obsluhu DTO
diff --git a/app/WorkshopTwoModule/Command/ExportToElastic.php b/app/WorkshopTwoModule/Command/ExportToElastic.php
new file mode 100644
index 0000000..7621c10
--- /dev/null
+++ b/app/WorkshopTwoModule/Command/ExportToElastic.php
@@ -0,0 +1,73 @@
+exportToElastic = $exportToElastic;
+ $this->delete = $delete;
+ $this->create = $create;
+ $this->workshopProductConfig = $workshopProductConfig;
+ }
+
+
+ public function configure(): void
+ {
+ $this->setName('workshopTwo:exportToElastic');
+ }
+
+
+ public function execute(
+ \Symfony\Component\Console\Input\InputInterface $input,
+ \Symfony\Component\Console\Output\OutputInterface $output
+ )
+ {
+ $options = new \Spameri\Elastic\Import\Run\Options(600);
+
+ // Clear index
+ try {
+ $this->delete->execute($this->workshopProductConfig->provide()->indexName());
+
+ } catch (\Spameri\Elastic\Exception\AbstractElasticSearchException $exception) {}
+
+ // Create index
+ $this->create->execute(
+ $this->workshopProductConfig->provide()->indexName(),
+ $this->workshopProductConfig->provide()->toArray()
+ );
+
+ // Export
+ $this->exportToElastic->execute($options);
+ }
+
+}
diff --git a/app/WorkshopTwoModule/Config/WorkshopProduct.neon b/app/WorkshopTwoModule/Config/WorkshopProduct.neon
new file mode 100644
index 0000000..00cc025
--- /dev/null
+++ b/app/WorkshopTwoModule/Config/WorkshopProduct.neon
@@ -0,0 +1,10 @@
+# WorkshopProduct.neon
+
+spameriElasticSearch:
+ entities:
+ WorkshopProduct:
+ index: workshop_product
+ dynamic: strict
+ config: @workshopTwo.workshopProductConfig
+
+ properties:
diff --git a/app/WorkshopTwoModule/Config/WorkshopTwoModule.neon b/app/WorkshopTwoModule/Config/WorkshopTwoModule.neon
new file mode 100644
index 0000000..0569bec
--- /dev/null
+++ b/app/WorkshopTwoModule/Config/WorkshopTwoModule.neon
@@ -0,0 +1,37 @@
+# WorkshopTwoModule.neon
+services:
+ workshopTwo.workshopProductService:
+ factory: App\WorkshopTwoModule\Model\WorkshopProductService
+ arguments:
+ - %spameriElasticSearch.entities.WorkshopProduct.index%
+ - @workshopTwo.workshopProductFactory
+ - @workshopTwo.workshopProductCollectionFactory
+
+ workshopTwo.workshopProductConfig:
+ factory: App\WorkshopTwoModule\Entity\WorkshopProductConfig
+ arguments:
+ - %spameriElasticSearch.entities.WorkshopProduct.index%
+
+ workshopTwo.workshopProductFactory:
+ factory: App\WorkshopTwoModule\Factory\WorkshopProductFactory
+
+ workshopTwo.workshopProductCollectionFactory:
+ factory: App\WorkshopTwoModule\Factory\WorkshopProductCollectionFactory
+
+ workshopTwo.DataImport:
+ factory: App\WorkshopTwoModule\Model\ExportToElastic\DataImport
+
+ workshopTwo.DataProvider:
+ factory: App\WorkshopTwoModule\Model\ExportToElastic\DataProvider
+
+ workshopTwo.PrepareImportData:
+ factory: App\WorkshopTwoModule\Model\ExportToElastic\PrepareImportData
+
+ workshopTwo.ExportToElastic:
+ factory: App\WorkshopTwoModule\Model\ExportToElastic
+
+ workshopTwo.ExportToElasticCommand:
+ factory: App\WorkshopTwoModule\Command\ExportToElastic
+ tags:
+ - kdyby.console.command
+ - console.command
diff --git a/app/WorkshopTwoModule/Entity/WorkshopProduct.php b/app/WorkshopTwoModule/Entity/WorkshopProduct.php
new file mode 100644
index 0000000..041aecd
--- /dev/null
+++ b/app/WorkshopTwoModule/Entity/WorkshopProduct.php
@@ -0,0 +1,237 @@
+id = $id;
+ $this->databaseId = $databaseId;
+ $this->name = $name;
+ $this->content = $content;
+ $this->alias = $alias;
+ $this->image = $image;
+ $this->price = $price;
+ $this->availability = $availability;
+ $this->tags = $tags;
+ $this->categories = $categories;
+ $this->purpose = $purpose;
+ $this->venality = $venality;
+ $this->brand = $brand;
+ }
+
+
+ public function id(): \Spameri\Elastic\Entity\Property\ElasticIdInterface
+ {
+ return $this->id;
+ }
+
+
+ public function entityVariables(): array
+ {
+ return \get_object_vars($this);
+ }
+
+
+ /**
+ * @return \Spameri\Elastic\Entity\Property\ElasticIdInterface
+ */
+ public function getId(): \Spameri\Elastic\Entity\Property\ElasticIdInterface
+ {
+ return $this->id;
+ }
+
+
+ /**
+ * @return int
+ */
+ public function getDatabaseId(): int
+ {
+ return $this->databaseId;
+ }
+
+
+ /**
+ * @return string
+ */
+ public function getName(): string
+ {
+ return $this->name;
+ }
+
+
+ /**
+ * @return string|null
+ */
+ public function getContent(): ?string
+ {
+ return $this->content;
+ }
+
+
+ /**
+ * @return string
+ */
+ public function getAlias(): string
+ {
+ return $this->alias;
+ }
+
+
+ /**
+ * @return string
+ */
+ public function getImage(): string
+ {
+ return $this->image;
+ }
+
+
+ /**
+ * @return float
+ */
+ public function getPrice(): float
+ {
+ return $this->price;
+ }
+
+
+ /**
+ * @return string
+ */
+ public function getAvailability(): string
+ {
+ return $this->availability;
+ }
+
+
+ /**
+ * @return array
+ */
+ public function getTags(): array
+ {
+ return $this->tags;
+ }
+
+
+ /**
+ * @return array
+ */
+ public function getCategories(): array
+ {
+ return $this->categories;
+ }
+
+
+ /**
+ * @return array
+ */
+ public function getPurpose(): array
+ {
+ return $this->purpose;
+ }
+
+
+ /**
+ * @return int
+ */
+ public function getVenality(): int
+ {
+ return $this->venality;
+ }
+
+
+ /**
+ * @return string
+ */
+ public function getBrand(): string
+ {
+ return $this->brand;
+ }
+
+}
diff --git a/app/WorkshopTwoModule/Entity/WorkshopProductConfig.php b/app/WorkshopTwoModule/Entity/WorkshopProductConfig.php
new file mode 100644
index 0000000..2adc2a2
--- /dev/null
+++ b/app/WorkshopTwoModule/Entity/WorkshopProductConfig.php
@@ -0,0 +1,230 @@
+indexName = $indexName;
+ }
+
+
+ public function provide(): \Spameri\ElasticQuery\Mapping\Settings
+ {
+ $stopWords = [
+ 'angin',
+ 'ml',
+ 'l',
+ 'litr',
+ 'litry',
+ 'litrů',
+ 'ks',
+ 'pastilka',
+ 'pastilky',
+ 'pastilek',
+ 'kapsle',
+ 'kapslí',
+ 'tbl',
+ 'tob',
+ 'dr',
+ 'cps',
+ 'x',
+ 'g',
+ 'mg',
+ 'báze',
+ 'bázi',
+ 'e',
+ 'dp',
+ 'duo',
+ 'v',
+ 'a',
+ 'plus',
+ 'por',
+ 'nob',
+ 'zn',
+ 'la',
+ 'lr',
+ 'b6',
+ 'n',
+ ];
+ $settings = new \Spameri\ElasticQuery\Mapping\Settings($this->indexName);
+ $stopFilter = new \Spameri\ElasticQuery\Mapping\Filter\Stop\Czech($stopWords);
+ $czechDictionary = new \Spameri\ElasticQuery\Mapping\Analyzer\Custom\CzechDictionary(
+ $stopFilter
+ );
+ $settings->addAnalyzer($czechDictionary);
+
+ $lowercase = new \Spameri\ElasticQuery\Mapping\Analyzer\Custom\Lowercase();
+ $settings->addAnalyzer($lowercase);
+
+ $edgeNgram = new \Spameri\ElasticQuery\Mapping\Analyzer\Custom\EdgeNgram(
+ 2,
+ 6,
+ $stopFilter
+ );
+ $settings->addAnalyzer($edgeNgram);
+
+ $wordSplit = new \Spameri\ElasticQuery\Mapping\Analyzer\Custom\WordDelimiter();
+ $settings->addAnalyzer($wordSplit);
+
+ $wordJoin = new \Spameri\ElasticQuery\Mapping\Analyzer\Custom\CommonGrams(
+ $stopWords
+ );
+ $settings->addAnalyzer($wordJoin);
+
+ $synonym = new \App\ProductModule\ElasticQuery\SynonymAnalyzer(
+ $stopFilter,
+ [
+ 'paralen => kaše',
+ ]
+ );
+ $settings->addAnalyzer($synonym);
+
+
+ // =========== FIELDS
+
+ $settings->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'databaseId',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_KEYWORD
+ )
+ );
+
+ $nameFields = new \Spameri\ElasticQuery\Mapping\Settings\Mapping\SubFields(
+ 'name',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT
+ );
+
+ $nameFields->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'czechDictionary',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT,
+ $czechDictionary
+ )
+ );
+ $nameFields->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'edgeNgram',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT,
+ $edgeNgram
+ )
+ );
+ $nameFields->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'wordSplit',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT,
+ $wordSplit
+ )
+ );
+ $nameFields->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'wordJoin',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT,
+ $wordJoin
+ )
+ );
+ $nameFields->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'czechSynonym',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT,
+ $synonym
+ )
+ );
+
+ $settings->addMappingSubField($nameFields);
+
+ $settings->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'content',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT,
+ $czechDictionary
+ )
+ );
+
+ $settings->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'alias',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_KEYWORD
+ )
+ );
+
+ $settings->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'image',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_KEYWORD
+ )
+ );
+
+ $settings->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'price',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_DOUBLE
+ )
+ );
+
+ $settings->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'availability',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT,
+ $lowercase,
+ TRUE
+ )
+ );
+
+ $settings->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'tags',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT,
+ $lowercase,
+ TRUE
+ )
+ );
+
+ $settings->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'categories',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT,
+ $lowercase,
+ TRUE
+ )
+ );
+
+ $settings->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'purpose',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT,
+ $lowercase,
+ TRUE
+ )
+ );
+
+ $settings->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'venality',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_INTEGER
+ )
+ );
+
+ $settings->addMappingField(
+ new \Spameri\ElasticQuery\Mapping\Settings\Mapping\Field(
+ 'brand',
+ \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_TEXT,
+ $lowercase,
+ TRUE
+ )
+ );
+
+ return $settings;
+ }
+
+}
diff --git a/app/WorkshopTwoModule/Factory/WorkshopProductCollectionFactory.php b/app/WorkshopTwoModule/Factory/WorkshopProductCollectionFactory.php
new file mode 100644
index 0000000..11fcefa
--- /dev/null
+++ b/app/WorkshopTwoModule/Factory/WorkshopProductCollectionFactory.php
@@ -0,0 +1,22 @@
+id()),
+ $hit->getValue('databaseId'),
+ $hit->getValue('name'),
+ $hit->getValue('content'),
+ $hit->getValue('alias'),
+ $hit->getValue('image'),
+ $hit->getValue('price'),
+ $hit->getValue('availability'),
+ $hit->getValue('tags'),
+ $hit->getValue('categories'),
+ $hit->getValue('purpose'),
+ $hit->getValue('venality'),
+ $hit->getValue('brand')
+ );
+ }
+
+}
diff --git a/app/WorkshopTwoModule/Model/ExportToElastic.php b/app/WorkshopTwoModule/Model/ExportToElastic.php
new file mode 100644
index 0000000..2315f16
--- /dev/null
+++ b/app/WorkshopTwoModule/Model/ExportToElastic.php
@@ -0,0 +1,25 @@
+workshopProductService = $workshopProductService;
+ }
+
+
+ /**
+ * @param \App\WorkshopTwoModule\Entity\WorkshopProduct $entity
+ */
+ public function import(
+ \Spameri\Elastic\Entity\AbstractImport $entity
+ ): \Spameri\Elastic\Import\ResponseInterface
+ {
+ $id = $this->workshopProductService->insert($entity);
+
+ return new \Spameri\Elastic\Import\Response\SimpleResponse(
+ $id,
+ $entity
+ );
+ }
+
+}
diff --git a/app/WorkshopTwoModule/Model/ExportToElastic/DataProvider.php b/app/WorkshopTwoModule/Model/ExportToElastic/DataProvider.php
new file mode 100644
index 0000000..ed5da24
--- /dev/null
+++ b/app/WorkshopTwoModule/Model/ExportToElastic/DataProvider.php
@@ -0,0 +1,37 @@
+ $data[0],
+ 'name' => $data[1],
+ 'content_description' => $data[2],
+ 'alias' => $data[3],
+ 'library_id' => $data[4],
+ 'amount' => $data[5],
+ 'availability_id' => $data[6],
+ 'isNew' => $data[7],
+ 'isFreeTransport' => $data[8],
+ 'isAction' => $data[9],
+ ];
+ }
+ }
+
+
+ public function count(\Spameri\Elastic\Import\Run\Options $options): int
+ {
+ return 23700;
+ }
+
+}
diff --git a/app/WorkshopTwoModule/Model/ExportToElastic/PrepareImportData.php b/app/WorkshopTwoModule/Model/ExportToElastic/PrepareImportData.php
new file mode 100644
index 0000000..968f63d
--- /dev/null
+++ b/app/WorkshopTwoModule/Model/ExportToElastic/PrepareImportData.php
@@ -0,0 +1,78 @@
+workshopProductService = $workshopProductService;
+ }
+
+
+ public function prepare($entityData): \Spameri\Elastic\Entity\AbstractImport
+ {
+ try {
+ $query = new \Spameri\ElasticQuery\ElasticQuery();
+ $query->addMustQuery(
+ new \Spameri\ElasticQuery\Query\Term(
+ 'databaseId',
+ $entityData['id']
+ )
+ );
+ $existingProduct = $this->workshopProductService->getBy($query);
+ $elasticId = $existingProduct->id();
+
+ } catch (\Spameri\Elastic\Exception\AbstractElasticSearchException $exception) {
+ $elasticId = new \Spameri\Elastic\Entity\Property\EmptyElasticId();
+ }
+
+ $split = \str_split((string) $entityData['library_id']);
+ $imageSrc = 'https://cdn.benu.cz/images/img-small-product/'
+ . \end($split) . '/'
+ . $entityData['library_id'] . '.jpg'
+ ;
+
+ $tags = [];
+ if ($entityData['isNew']) {
+ $tags[] = 'Novinka';
+ }
+ if ($entityData['isFreeTransport']) {
+ $tags[] = 'Doprava zdarma';
+ }
+ if ($entityData['isAction']) {
+ $tags[] = 'Akční cena';
+ }
+
+ $purpose[] = \array_rand(\array_flip(\App\ProductModule\Model\ExportToElastic\Purposes::VALUES));
+ $brand = \array_rand(\array_flip(\App\ProductModule\Model\ExportToElastic\Brands::VALUES));
+ $categories[] = \array_rand(\array_flip(\App\ProductModule\Model\ExportToElastic\Categories::VALUES));
+ $categories[] = \array_rand(\array_flip(\App\ProductModule\Model\ExportToElastic\Categories::VALUES));
+
+ return new \App\WorkshopTwoModule\Entity\WorkshopProduct(
+ $elasticId,
+ (int) $entityData['id'],
+ $entityData['name'],
+ $entityData['content_description'],
+ $entityData['alias'],
+ $imageSrc,
+ (float) $entityData['amount'],
+ $entityData['availability_id'] === '1' ? 'Skladem' : 'Nedostupné',
+ $tags,
+ $categories,
+ $purpose,
+ \random_int(0, 1000),
+ $brand
+ );
+ }
+
+}
diff --git a/app/WorkshopTwoModule/Model/WorkshopProductService.php b/app/WorkshopTwoModule/Model/WorkshopProductService.php
new file mode 100644
index 0000000..54a836b
--- /dev/null
+++ b/app/WorkshopTwoModule/Model/WorkshopProductService.php
@@ -0,0 +1,16 @@
+productService = $productService;
+ }
+
+
+ public function renderDefault($queryString): void
+ {
+ $query = $this->buildQuery($queryString);
+
+ try {
+ $products = $this->productService->getAllBy($query);
+
+ } catch (\Spameri\Elastic\Exception\AbstractElasticSearchException $exception) {
+ $products = [];
+ \Tracy\Debugger::barDump($exception);
+ }
+
+ $this->getTemplate()->add(
+ 'products',
+ $products
+ );
+ $this->getTemplate()->add(
+ 'queryString',
+ $queryString
+ );
+ }
+
+
+ public function createComponentSearchForm() :\Nette\Application\UI\Form
+ {
+ $form = new \Nette\Application\UI\Form();
+ $form->addText('queryString', 'query')
+ ->setAttribute('class', 'inp-text suggest')
+ ;
+
+ $form->addSubmit('search', 'Search');
+
+ $form->onSuccess[] = function () use ($form) {
+ $this->redirect(
+ 301,
+ ':WorkshopTwo:Workshop:default',
+ [
+ 'queryString' => $form->getValues()->queryString,
+ ]
+ );
+ };
+
+ return $form;
+ }
+
+
+ public function buildQuery(?string $queryString): \Spameri\ElasticQuery\ElasticQuery
+ {
+ $query = new \Spameri\ElasticQuery\ElasticQuery();
+ $shouldCollection = new \Spameri\ElasticQuery\Query\ShouldCollection();
+ $mustCollection = new \Spameri\ElasticQuery\Query\MustCollection();
+ $mustNotCollection = new \Spameri\ElasticQuery\Query\MustNotCollection();
+
+ $mustCollection->add(
+ new \Spameri\ElasticQuery\Query\MultiMatch(
+ [
+ 'name.czechDictionary',
+ 'name.edgeNgram',
+ 'name.wordSplit',
+ 'name.wordJoin',
+ 'name.czechSynonym',
+ ],
+ $queryString,
+ 3,
+ \Spameri\ElasticQuery\Query\Match\MultiMatchType::BEST_FIELDS,
+ \Spameri\ElasticQuery\Query\Match\Operator::OR,
+ new \Spameri\ElasticQuery\Query\Match\Fuzziness(
+ \Spameri\ElasticQuery\Query\Match\Fuzziness::AUTO
+ ),
+ 'czechDictionary'
+ )
+ );
+
+ // ===============
+
+ $mustCollection->add(
+ new \Spameri\ElasticQuery\Query\Term(
+ 'availability',
+ 'skladem'
+ )
+ );
+
+ $mustCollection->add(
+ new \Spameri\ElasticQuery\Query\Range(
+ 'price',
+ 1
+ )
+ );
+
+ $mustCollection->add(
+ new \Spameri\ElasticQuery\Query\Exists('image')
+ );
+
+ $query->addMustQuery(
+ new \Spameri\ElasticQuery\Query\QueryCollection(
+ $mustCollection,
+ $shouldCollection,
+ $mustNotCollection
+ )
+ );
+
+ $query->options()->changeSize(20);
+
+
+ // =========== AGGS
+
+
+ $query->addAggregation(
+ new \Spameri\ElasticQuery\Aggregation\LeafAggregationCollection(
+ 'price',
+ NULL,
+ new \Spameri\ElasticQuery\Aggregation\Range(
+ 'price',
+ TRUE,
+ new \Spameri\ElasticQuery\Aggregation\RangeValueCollection(
+ new \Spameri\ElasticQuery\Aggregation\RangeValue(
+ '0 - 50 Kč',
+ 0,
+ 50
+ ),
+ new \Spameri\ElasticQuery\Aggregation\RangeValue('50 - 100 Kč', 50, 100),
+ new \Spameri\ElasticQuery\Aggregation\RangeValue('100 - 200 Kč', 100, 200),
+ new \Spameri\ElasticQuery\Aggregation\RangeValue('200 - 500 Kč', 200, 500),
+ new \Spameri\ElasticQuery\Aggregation\RangeValue('500 - 1000 Kč', 500, 1000)
+ )
+ )
+ )
+ );
+
+
+ $priceFrom = $this->getParameter('priceFrom');
+ $this->template->add('priceFrom', $priceFrom);
+ $priceTo = $this->getParameter('priceTo');
+ $filter = new \Spameri\ElasticQuery\Filter\FilterCollection();
+ if ($priceFrom !== NULL && $priceTo !== NULL ) {
+ $filter->must()->add(
+ new \Spameri\ElasticQuery\Query\Range(
+ 'price',
+ $priceFrom,
+ $priceTo
+ )
+ );
+ }
+ $query->addAggregation(
+ new \Spameri\ElasticQuery\Aggregation\LeafAggregationCollection(
+ 'categories',
+ $filter,
+ new \Spameri\ElasticQuery\Aggregation\Term(
+ 'categories',
+ 100
+ )
+ )
+ );
+
+ $query->addAggregation(
+ new \Spameri\ElasticQuery\Aggregation\LeafAggregationCollection(
+ 'brands',
+ NULL,
+ new \Spameri\ElasticQuery\Aggregation\Term(
+ 'brand',
+ 1000
+ )
+ )
+ );
+
+ return $query;
+ }
+
+}
diff --git a/app/WorkshopTwoModule/templates/@layout.latte b/app/WorkshopTwoModule/templates/@layout.latte
new file mode 100644
index 0000000..d343285
--- /dev/null
+++ b/app/WorkshopTwoModule/templates/@layout.latte
@@ -0,0 +1,31 @@
+{**
+ * @param string $basePath web base path
+ * @param array $flashes flash messages
+ *}
+
+
+
+
+
+ {ifset title}{include title|stripHtml} | {/ifset}Nette Sandbox
+
+
+
+
+
+ {block head}{/block}
+
+
+
+ {$flash->message}
+
+ {include content}
+
+ {block scripts}
+
+
+
+
+ {/block}
+
+
diff --git a/app/WorkshopTwoModule/templates/Workshop/default.latte b/app/WorkshopTwoModule/templates/Workshop/default.latte
new file mode 100644
index 0000000..40b7d0b
--- /dev/null
+++ b/app/WorkshopTwoModule/templates/Workshop/default.latte
@@ -0,0 +1,110 @@
+{block content}
+
+
Workshop
+
+
+
+ {form searchForm}
+
+ {/form}
+
You have searched: {$queryString}
+
+
+
+
+
+ {foreach $products as $product}
+
+
+
+ {/foreach}
+
+
+
+{/block}
diff --git a/app/config/config.neon b/app/config/config.neon
index a485f9f..0c0b8eb 100644
--- a/app/config/config.neon
+++ b/app/config/config.neon
@@ -14,7 +14,6 @@ dibi:
spameriElasticSearch:
debug: true
- entities:
parameters:
@@ -32,7 +31,16 @@ session:
services:
router: App\RouterFactory::createRouter
+# Uncomment this if you want to log export to elasctic
+# - Spameri\Elastic\Import\Run\LoggerHandler(@monolog.logger)
+
+
includes:
+ - ../ProductModule/Config/ProductModule.neon
+
- ../ProductModule/Config/Product.neon
- ../ProductModule/Config/SimpleProduct.neon
- - ../ProductModule/Config/ProductModule.neon
\ No newline at end of file
+ - ../ProductModule/Config/WorkshopProduct.neon
+
+ - ../WorkshopTwoModule/Config/WorkshopTwoModule.neon
+ - ../WorkshopTwoModule/Config/WorkshopProduct.neon
diff --git a/composer.json b/composer.json
index e3b7838..8b110c4 100644
--- a/composer.json
+++ b/composer.json
@@ -11,7 +11,7 @@
}
],
"require": {
- "php": ">=7.1.0",
+ "php": ">=8.1",
"nette/application": "^2.4.4",
"nette/bootstrap": "^2.4.3",
"nette/caching": "^2.5",
diff --git a/composer.lock b/composer.lock
index 818a75b..90b49c5 100644
--- a/composer.lock
+++ b/composer.lock
@@ -1,23 +1,23 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
- "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "f5a5cf6800f71c8bb3469bac3d295a16",
"packages": [
{
"name": "dibi/dibi",
- "version": "v4.1.2",
+ "version": "v4.1.3",
"source": {
"type": "git",
"url": "https://github.com/dg/dibi.git",
- "reference": "f18056a0664a8d86406394e80081427a81cf5435"
+ "reference": "ed2a82741993706c15dbd4f5b8dd7eb5b75f7aa2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/dg/dibi/zipball/f18056a0664a8d86406394e80081427a81cf5435",
- "reference": "f18056a0664a8d86406394e80081427a81cf5435",
+ "url": "https://api.github.com/repos/dg/dibi/zipball/ed2a82741993706c15dbd4f5b8dd7eb5b75f7aa2",
+ "reference": "ed2a82741993706c15dbd4f5b8dd7eb5b75f7aa2",
"shasum": ""
},
"require": {
@@ -69,20 +69,20 @@
"sqlite",
"sqlsrv"
],
- "time": "2020-02-23T17:50:27+00:00"
+ "time": "2020-03-26T03:10:39+00:00"
},
{
"name": "elasticsearch/elasticsearch",
- "version": "v7.6.1",
+ "version": "v7.9.0",
"source": {
"type": "git",
"url": "https://github.com/elastic/elasticsearch-php.git",
- "reference": "d4f24bc43c2af60aece3df20eb689d322f9c8acf"
+ "reference": "1380925ccd276ab897c76596cf3705cb9714a78c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/d4f24bc43c2af60aece3df20eb689d322f9c8acf",
- "reference": "d4f24bc43c2af60aece3df20eb689d322f9c8acf",
+ "url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/1380925ccd276ab897c76596cf3705cb9714a78c",
+ "reference": "1380925ccd276ab897c76596cf3705cb9714a78c",
"shasum": ""
},
"require": {
@@ -132,7 +132,7 @@
"elasticsearch",
"search"
],
- "time": "2020-02-15T00:09:00+00:00"
+ "time": "2020-08-18T13:44:18+00:00"
},
{
"name": "ezimuel/guzzlestreams",
@@ -509,16 +509,16 @@
},
{
"name": "latte/latte",
- "version": "v2.6.1",
+ "version": "v2.8.1",
"source": {
"type": "git",
"url": "https://github.com/nette/latte.git",
- "reference": "82321e0d039d7b7e3324b5a7cb8f046a69458da9"
+ "reference": "fc94bd63fe995b40cb219109026e76f281c709c2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/nette/latte/zipball/82321e0d039d7b7e3324b5a7cb8f046a69458da9",
- "reference": "82321e0d039d7b7e3324b5a7cb8f046a69458da9",
+ "url": "https://api.github.com/repos/nette/latte/zipball/fc94bd63fe995b40cb219109026e76f281c709c2",
+ "reference": "fc94bd63fe995b40cb219109026e76f281c709c2",
"shasum": ""
},
"require": {
@@ -530,6 +530,7 @@
"nette/application": "<2.4.1"
},
"require-dev": {
+ "nette/php-generator": "^3.3.4",
"nette/tester": "~2.0",
"nette/utils": "^3.0",
"phpstan/phpstan": "^0.12",
@@ -537,13 +538,15 @@
},
"suggest": {
"ext-fileinfo": "to use filter |datastream",
+ "ext-iconv": "to use filters |reverse, |substring",
"ext-mbstring": "to use filters like lower, upper, capitalize, ...",
+ "nette/php-generator": "to use tag {templatePrint}",
"nette/utils": "to use filter |webalize"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.6-dev"
+ "dev-master": "2.8-dev"
}
},
"autoload": {
@@ -579,20 +582,20 @@
"template",
"twig"
],
- "time": "2020-01-14T18:32:37+00:00"
+ "time": "2020-05-12T11:07:07+00:00"
},
{
"name": "monolog/monolog",
- "version": "1.25.3",
+ "version": "1.25.5",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
- "reference": "fa82921994db851a8becaf3787a9e73c5976b6f1"
+ "reference": "1817faadd1846cd08be9a49e905dc68823bc38c0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fa82921994db851a8becaf3787a9e73c5976b6f1",
- "reference": "fa82921994db851a8becaf3787a9e73c5976b6f1",
+ "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1817faadd1846cd08be9a49e905dc68823bc38c0",
+ "reference": "1817faadd1846cd08be9a49e905dc68823bc38c0",
"shasum": ""
},
"require": {
@@ -606,11 +609,10 @@
"aws/aws-sdk-php": "^2.4.9 || ^3.0",
"doctrine/couchdb": "~1.0@dev",
"graylog2/gelf-php": "~1.0",
- "jakub-onderka/php-parallel-lint": "0.9",
"php-amqplib/php-amqplib": "~2.4",
"php-console/php-console": "^3.1.3",
+ "php-parallel-lint/php-parallel-lint": "^1.0",
"phpunit/phpunit": "~4.5",
- "phpunit/phpunit-mock-objects": "2.3.0",
"ruflin/elastica": ">=0.90 <3.0",
"sentry/sentry": "^0.13",
"swiftmailer/swiftmailer": "^5.3|^6.0"
@@ -657,20 +659,30 @@
"logging",
"psr-3"
],
- "time": "2019-12-20T14:15:16+00:00"
+ "funding": [
+ {
+ "url": "https://github.com/Seldaek",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/monolog/monolog",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-07-23T08:35:51+00:00"
},
{
"name": "nette/application",
- "version": "v2.4.14",
+ "version": "v2.4.16",
"source": {
"type": "git",
"url": "https://github.com/nette/application.git",
- "reference": "86a28664ca5594a6f97db889fd480cf4cf737218"
+ "reference": "e32c04de211873c792d13d9a00c50083b8e05a23"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/nette/application/zipball/86a28664ca5594a6f97db889fd480cf4cf737218",
- "reference": "86a28664ca5594a6f97db889fd480cf4cf737218",
+ "url": "https://api.github.com/repos/nette/application/zipball/e32c04de211873c792d13d9a00c50083b8e05a23",
+ "reference": "e32c04de211873c792d13d9a00c50083b8e05a23",
"shasum": ""
},
"require": {
@@ -709,9 +721,6 @@
"autoload": {
"classmap": [
"src/"
- ],
- "files": [
- "src/compatibility.php"
]
},
"notification-url": "https://packagist.org/downloads/",
@@ -744,7 +753,7 @@
"routing",
"seo"
],
- "time": "2019-11-19T18:47:13+00:00"
+ "time": "2020-08-25T01:51:49+00:00"
},
{
"name": "nette/bootstrap",
@@ -1226,16 +1235,16 @@
},
{
"name": "nette/neon",
- "version": "v3.0.0",
+ "version": "v3.0.1",
"source": {
"type": "git",
"url": "https://github.com/nette/neon.git",
- "reference": "cbff32059cbdd8720deccf9e9eace6ee516f02eb"
+ "reference": "5674a266495125d43d9fb58d6663b98bd827fa81"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/nette/neon/zipball/cbff32059cbdd8720deccf9e9eace6ee516f02eb",
- "reference": "cbff32059cbdd8720deccf9e9eace6ee516f02eb",
+ "url": "https://api.github.com/repos/nette/neon/zipball/5674a266495125d43d9fb58d6663b98bd827fa81",
+ "reference": "5674a266495125d43d9fb58d6663b98bd827fa81",
"shasum": ""
},
"require": {
@@ -1274,8 +1283,8 @@
"homepage": "https://nette.org/contributors"
}
],
- "description": "? Nette NEON: encodes and decodes NEON file format.",
- "homepage": "http://ne-on.org",
+ "description": "🍸 Nette NEON: encodes and decodes NEON file format.",
+ "homepage": "https://ne-on.org",
"keywords": [
"export",
"import",
@@ -1283,20 +1292,20 @@
"nette",
"yaml"
],
- "time": "2019-02-05T21:30:40+00:00"
+ "time": "2020-03-04T11:45:23+00:00"
},
{
"name": "nette/php-generator",
- "version": "v3.3.4",
+ "version": "v3.4.1",
"source": {
"type": "git",
"url": "https://github.com/nette/php-generator.git",
- "reference": "8fe7e699dca7db186f56d75800cb1ec32e39c856"
+ "reference": "7051954c534cebafd650efe8b145ac75b223cb66"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/nette/php-generator/zipball/8fe7e699dca7db186f56d75800cb1ec32e39c856",
- "reference": "8fe7e699dca7db186f56d75800cb1ec32e39c856",
+ "url": "https://api.github.com/repos/nette/php-generator/zipball/7051954c534cebafd650efe8b145ac75b223cb66",
+ "reference": "7051954c534cebafd650efe8b145ac75b223cb66",
"shasum": ""
},
"require": {
@@ -1305,13 +1314,17 @@
},
"require-dev": {
"nette/tester": "^2.0",
+ "nikic/php-parser": "^4.4",
"phpstan/phpstan": "^0.12",
"tracy/tracy": "^2.3"
},
+ "suggest": {
+ "nikic/php-parser": "to use ClassType::withBodiesFrom() & GlobalFunction::withBodyFrom()"
+ },
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.3-dev"
+ "dev-master": "3.4-dev"
}
},
"autoload": {
@@ -1343,7 +1356,7 @@
"php",
"scaffolding"
],
- "time": "2020-02-09T14:39:09+00:00"
+ "time": "2020-06-19T14:31:47+00:00"
},
{
"name": "nette/reflection",
@@ -1477,16 +1490,16 @@
},
{
"name": "nette/safe-stream",
- "version": "v2.4.0",
+ "version": "v2.4.1",
"source": {
"type": "git",
"url": "https://github.com/nette/safe-stream.git",
- "reference": "5e46d5fe397956d697501785d50b16fecea8e935"
+ "reference": "ae6f314041892138cb38b4ff8782e92e03750918"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/nette/safe-stream/zipball/5e46d5fe397956d697501785d50b16fecea8e935",
- "reference": "5e46d5fe397956d697501785d50b16fecea8e935",
+ "url": "https://api.github.com/repos/nette/safe-stream/zipball/ae6f314041892138cb38b4ff8782e92e03750918",
+ "reference": "ae6f314041892138cb38b4ff8782e92e03750918",
"shasum": ""
},
"require": {
@@ -1494,6 +1507,7 @@
},
"require-dev": {
"nette/tester": "^2.0",
+ "phpstan/phpstan": "^0.12",
"tracy/tracy": "^2.3"
},
"type": "library",
@@ -1510,8 +1524,8 @@
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause",
- "GPL-2.0",
- "GPL-3.0"
+ "GPL-2.0-only",
+ "GPL-3.0-only"
],
"authors": [
{
@@ -1531,7 +1545,7 @@
"nette",
"safe"
],
- "time": "2019-02-06T00:22:25+00:00"
+ "time": "2020-03-16T14:26:30+00:00"
},
{
"name": "nette/security",
@@ -1681,16 +1695,16 @@
},
{
"name": "psr/log",
- "version": "1.1.2",
+ "version": "1.1.3",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
- "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801"
+ "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801",
- "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc",
+ "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc",
"shasum": ""
},
"require": {
@@ -1724,27 +1738,27 @@
"psr",
"psr-3"
],
- "time": "2019-11-01T11:05:21+00:00"
+ "time": "2020-03-23T09:12:05+00:00"
},
{
"name": "react/promise",
- "version": "v2.7.1",
+ "version": "v2.8.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/promise.git",
- "reference": "31ffa96f8d2ed0341a57848cbb84d88b89dd664d"
+ "reference": "f3cff96a19736714524ca0dd1d4130de73dbbbc4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/reactphp/promise/zipball/31ffa96f8d2ed0341a57848cbb84d88b89dd664d",
- "reference": "31ffa96f8d2ed0341a57848cbb84d88b89dd664d",
+ "url": "https://api.github.com/repos/reactphp/promise/zipball/f3cff96a19736714524ca0dd1d4130de73dbbbc4",
+ "reference": "f3cff96a19736714524ca0dd1d4130de73dbbbc4",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"require-dev": {
- "phpunit/phpunit": "~4.8"
+ "phpunit/phpunit": "^7.0 || ^6.5 || ^5.7 || ^4.8.36"
},
"type": "library",
"autoload": {
@@ -1770,7 +1784,7 @@
"promise",
"promises"
],
- "time": "2019-01-07T21:25:54+00:00"
+ "time": "2020-05-12T15:16:56+00:00"
},
{
"name": "spameri/elastic",
@@ -1778,12 +1792,12 @@
"source": {
"type": "git",
"url": "https://github.com/Spameri/Elastic.git",
- "reference": "205c49ce5a2e931343fa60eaed86e41ad6158264"
+ "reference": "6b6b1aabf753f307d271098ac5f2fcce9cef01c2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Spameri/Elastic/zipball/205c49ce5a2e931343fa60eaed86e41ad6158264",
- "reference": "205c49ce5a2e931343fa60eaed86e41ad6158264",
+ "url": "https://api.github.com/repos/Spameri/Elastic/zipball/6b6b1aabf753f307d271098ac5f2fcce9cef01c2",
+ "reference": "6b6b1aabf753f307d271098ac5f2fcce9cef01c2",
"shasum": ""
},
"require": {
@@ -1805,7 +1819,7 @@
"nette/http": "^2.4.7",
"nette/tester": "^2.2.0",
"php-coveralls/php-coveralls": "^2.1",
- "phpstan/phpstan-shim": "^0.11.5",
+ "phpstan/phpstan": "0.12.38",
"spameri/coding-standard": "dev-master",
"spameri/dependency-mocker": "^1.3"
},
@@ -1835,7 +1849,7 @@
"nette",
"spameri"
],
- "time": "2020-02-24T01:13:47+00:00"
+ "time": "2020-09-23T12:44:03+00:00"
},
{
"name": "spameri/elastic-query",
@@ -1843,12 +1857,12 @@
"source": {
"type": "git",
"url": "https://github.com/Spameri/ElasticQuery.git",
- "reference": "112375cb1fec61bcbb8a0ed13ebcb321da0713d8"
+ "reference": "ac563b88bcf260705a92454085051620da5dcb8c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Spameri/ElasticQuery/zipball/112375cb1fec61bcbb8a0ed13ebcb321da0713d8",
- "reference": "112375cb1fec61bcbb8a0ed13ebcb321da0713d8",
+ "url": "https://api.github.com/repos/Spameri/ElasticQuery/zipball/ac563b88bcf260705a92454085051620da5dcb8c",
+ "reference": "ac563b88bcf260705a92454085051620da5dcb8c",
"shasum": ""
},
"require": {
@@ -1859,7 +1873,7 @@
"elasticsearch/elasticsearch": "^7",
"guzzlehttp/guzzle": "^6.3",
"nette/tester": "v2.3.1",
- "phpstan/phpstan-shim": "v0.11.4",
+ "phpstan/phpstan": "v0.12.37",
"spameri/coding-standard": "@dev"
},
"type": "library",
@@ -1876,20 +1890,20 @@
}
],
"description": "Objects instead of arrays for querying to ElasticSearch.",
- "time": "2020-02-24T01:13:46+00:00"
+ "time": "2020-09-20T07:53:34+00:00"
},
{
"name": "symfony/console",
- "version": "v3.4.37",
+ "version": "v3.4.44",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
- "reference": "7c5bdd346f9d90a2d22d4e1fe61e02dc19b98f12"
+ "reference": "71da881ad579f0cd66aef8677e4cf6217d8ecd0c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/console/zipball/7c5bdd346f9d90a2d22d4e1fe61e02dc19b98f12",
- "reference": "7c5bdd346f9d90a2d22d4e1fe61e02dc19b98f12",
+ "url": "https://api.github.com/repos/symfony/console/zipball/71da881ad579f0cd66aef8677e4cf6217d8ecd0c",
+ "reference": "71da881ad579f0cd66aef8677e4cf6217d8ecd0c",
"shasum": ""
},
"require": {
@@ -1948,20 +1962,34 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
- "time": "2020-01-10T07:52:48+00:00"
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-08-09T08:16:57+00:00"
},
{
"name": "symfony/debug",
- "version": "v3.4.37",
+ "version": "v3.4.44",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
- "reference": "70dd18e93bb8bdf3c4db7fde832619fef9828cf8"
+ "reference": "0893a0b07c499a1530614d65869ea6a7b1b8a164"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/debug/zipball/70dd18e93bb8bdf3c4db7fde832619fef9828cf8",
- "reference": "70dd18e93bb8bdf3c4db7fde832619fef9828cf8",
+ "url": "https://api.github.com/repos/symfony/debug/zipball/0893a0b07c499a1530614d65869ea6a7b1b8a164",
+ "reference": "0893a0b07c499a1530614d65869ea6a7b1b8a164",
"shasum": ""
},
"require": {
@@ -2004,20 +2032,34 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
- "time": "2020-01-08T16:36:15+00:00"
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-08-09T08:13:48+00:00"
},
{
"name": "symfony/polyfill-mbstring",
- "version": "v1.14.0",
+ "version": "v1.18.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
- "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2"
+ "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2",
- "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/a6977d63bf9a0ad4c65cd352709e230876f9904a",
+ "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a",
"shasum": ""
},
"require": {
@@ -2029,7 +2071,11 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.14-dev"
+ "dev-master": "1.18-dev"
+ },
+ "thanks": {
+ "name": "symfony/polyfill",
+ "url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
@@ -2063,20 +2109,34 @@
"portable",
"shim"
],
- "time": "2020-01-13T11:15:53+00:00"
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-07-14T12:35:20+00:00"
},
{
"name": "tracy/tracy",
- "version": "v2.6.6",
+ "version": "v2.6.8",
"source": {
"type": "git",
"url": "https://github.com/nette/tracy.git",
- "reference": "d219f53644e1112ffcb62baff13959fa69f1f07a"
+ "reference": "d3bb9f43692df5e3b83ab8004d3e6208034ac0ca"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/nette/tracy/zipball/d219f53644e1112ffcb62baff13959fa69f1f07a",
- "reference": "d219f53644e1112ffcb62baff13959fa69f1f07a",
+ "url": "https://api.github.com/repos/nette/tracy/zipball/d3bb9f43692df5e3b83ab8004d3e6208034ac0ca",
+ "reference": "d3bb9f43692df5e3b83ab8004d3e6208034ac0ca",
"shasum": ""
},
"require": {
@@ -2130,7 +2190,7 @@
"nette",
"profiler"
],
- "time": "2020-01-02T18:07:31+00:00"
+ "time": "2020-05-17T09:37:45+00:00"
}
],
"packages-dev": [],
@@ -2155,5 +2215,6 @@
"platform-dev": [],
"platform-overrides": {
"php": "7.1"
- }
+ },
+ "plugin-api-version": "1.1.0"
}
diff --git a/examples_september_20 b/examples_september_20
new file mode 100644
index 0000000..0377e84
--- /dev/null
+++ b/examples_september_20
@@ -0,0 +1,640 @@
+GET /
+
+GET _cat
+
+GET _cat/indices
+
+GET _settings
+
+GET workshop_product/_settings
+
+GET workshop_product/_mapping
+
+
+
+
+POST workshop_page_9999/_doc
+{
+ "name": "Opatření covid-19"
+}
+
+POST workshop_page/_doc/tIsptXQB7WIJAVF7u9YM
+{
+ "name": "Opatření covid-19",
+ "content": "Zůstaňte doma!"
+}
+
+GET workshop_page/_mapping
+
+GET workshop_page/_search
+
+GET workshop_page/_doc/tIsptXQB7WIJAVF7u9YM
+
+DELETE workshop_page_120345123
+
+GET workshop_page/_search
+
+GET _alias
+
+POST /_aliases
+{
+ "actions" : [
+ {
+ "add" : {
+ "index" : "workshop_page_120345123",
+ "alias" : "workshop_page"
+ }
+ },
+ {
+ "remove": {
+ "index": "workshop_page_9999",
+ "alias" : "workshop_page"
+ }
+ }
+ ]
+}
+
+POST workshop_page/_doc
+{
+ "něco": "něco"
+}
+
+GET workshop_page/_analyze
+{
+ "text": ["PlayStation 5 je super, protože má AMD procesor."],
+ "analyzer": "czech"
+}
+
+
+GET workshop_page/_analyze
+{
+ "text": ["Všem osobám s přechodným a trvalým pobytem v České republice pobývajícím na území České republiky nad 90 dní nebo zaměstnaným na území České republiky, které se v období od 7. března 2020 navrátí z pobytu na území Italské republiky do České republiky, se nařizuje, aby bezprostředně po návratu do České republiky oznámily tuto skutečnost, a to telefonicky nebo jiným vzdáleným přístupem, svému registrujícímu poskytovateli zdravotních služeb v oboru všeobecné praktické lékařství nebo praktické lékařství pro děti a dorost, nebo nemají-li registrujícího poskytovatele, pak jakémukoli poskytovateli v oboru všeobecné praktické lékařství nebo praktické lékařství pro děti a dorost."],
+ "analyzer": "custom_analyzer"
+}
+
+
+DELETE workshop_page
+
+PUT workshop_page
+{
+ "settings": {
+ "analysis": {
+ "analyzer": {
+ "custom_analyzer": {
+ "type": "custom",
+ "tokenizer": "standard",
+ "filter": [
+ "lowercase",
+ "asciifolding"
+ ]
+ }
+ }
+ }
+ }
+}
+
+GET workshop_page/_settings
+
+GET workshop_page/_search
+
+PUT workshop_page/_mapping
+{
+ "properties": {
+ "name": {
+ "type": "text",
+ "analyzer": "custom_analyzer"
+ }
+ }
+}
+
+GET workshop_page/_mapping
+
+POST workshop_page/_doc
+{
+ "name": "Předchozí Mimořádné opatření ze dne 6. března 2020, č.j. MZDR 5503/2020-10/PRO, se ruší.",
+ "isPublic": true
+}
+
+GET workshop_page/_doc/u4uxtXQB7WIJAVF7e9bs
+
+
+GET workshop_page/_search
+{
+ "query": {
+ "bool": {
+ "must": [
+ {
+ "term": {
+ "name": {
+ "value": "MZDR"
+ }
+ }
+ }
+ ]
+ }
+ }
+}
+
+
+GET workshop_page/_search
+{
+ "query": {
+ "bool": {
+ "must": [
+ {
+ "match": {
+ "name": {
+ "query": "MZDR pro se rusi",
+ "analyzer": "custom_analyzer",
+ "boost": 3,
+ "operator": "or",
+ "fuzziness": "auto",
+ "minimum_should_match": "80%"
+ }
+ }
+ }
+ ]
+ }
+ }
+}
+
+
+GET workshop_page/_search
+{
+ "query": {
+ "bool": {
+ "must": [
+ {
+ "match_phrase": {
+ "name": "MZDR rusi"
+ }
+ }
+ ]
+ }
+ }
+}
+
+GET workshop_page/_search
+{
+ "query": {
+ "bool": {
+ "should": [
+ {
+ "wildcard": {
+ "name": "mzd*"
+ }
+ },
+ {
+ "fuzzy": {
+ "content": {
+ "value": "MZDR"
+ }
+ }
+ },
+ {
+ "range": {
+ "price": {
+ "gte": 100,
+ "lte": 1000
+ }
+ }
+ }
+ ],
+ "must": [
+ {
+ "term": {
+ "isPublic": {
+ "value": true
+ }
+ }
+ },
+ {
+ "match": {
+ "identification.imdb": "tt0001234"
+ }
+ },
+ {
+ "bool": {
+ "should": [
+ {
+ "term":{
+ "isPublic": {
+ "value": true
+ }
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "must_not": [
+ {
+ "term": {
+ "isPublic": {
+ "value": false
+ }
+ }
+ }
+ ]
+ }
+ }
+}
+
+
+
+
+
+POST products_analyzers/_doc
+{
+ "name": "EXCIPIAL U HYDROLOTIO 20MG/ML kožní podání EML 200ML",
+ "isPublic": true,
+ "databaseId": 108739,
+ "content": "Excipial U Hydrolotio chrání a ošetřuje pokožku. Pomocí hydratace a tvorby přirozeného ochranného filmu z lipidů zlepšuje a normalizuje stav pokožky, vyhlazuje její drsný povrch a napomáhá jí udržovat si svou elasticitu a odolnost proti vnějším vlivům. Přípravek je možné použít při péči o pokožku při doléčování kožních onemocnění.",
+ "purpose": [
+ "Koronavir"
+ ],
+ "availability": "nevíme",
+ "variants": [
+ {
+ "price": 1200,
+ "barva": "žlutá"
+ },
+ {
+ "price": 1000,
+ "barva": "černá"
+ }
+ ]
+}
+
+GET products/_search
+
+
+PUT products_ngram
+{
+ "settings": {
+ "analysis": {
+ "filter": {
+ "customEdgeNgram": {
+ "type": "edge_ngram",
+ "min_gram": 2,
+ "max_gram": 6
+ }
+ }
+ }
+ }
+}
+
+GET products_ngram/_analyze
+{
+ "text": ["Předchozí Mimořádné opatření ze dne 6. března 2020, č.j. MZDR 5503/2020-10/PRO, se ruší."],
+ "filter": [
+ "customEdgeNgram"
+ ],
+ "tokenizer": "standard"
+}
+
+PUT products_synonym
+{
+ "settings": {
+ "analysis": {
+ "filter": {
+ "customSynonym": {
+ "type": "synonym",
+ "synonyms": [
+ "MZDR => Ministerstvo",
+ "MZDR => Banda",
+ "Mimořádné => rychlé včasné okamžité"
+ ]
+ }
+ }
+ }
+ }
+}
+
+
+GET products_synonym/_analyze
+{
+ "text": ["Předchozí Mimořádné opatření ze dne 6. března 2020, č.j. MZDR 5503/2020-10/PRO, se ruší."],
+ "filter": [
+ "customSynonym"
+ ],
+ "tokenizer": "standard"
+}
+
+PUT products_dictionary
+{
+ "settings": {
+ "analysis": {
+ "filter": {
+ "dictionary_CZ": {
+ "type": "hunspell",
+ "locale": "cs_CZ"
+ }
+ }
+ }
+ }
+}
+
+
+GET products_dictionary/_analyze
+{
+ "text": ["Předchozí Mimořádné opatření ze dne 6. března 2020, č.j. MZDR 5503/2020-10/PRO, se ruší."],
+ "filter": [
+ "dictionary_CZ"
+ ],
+ "tokenizer": "standard"
+}
+
+
+PUT products_common_grams
+{
+ "settings": {
+ "analysis": {
+ "filter": {
+ "customCommonGrams": {
+ "type": "common_grams",
+ "common_words": [
+ "ks",
+ "l",
+ "litr",
+ "litry",
+ "litrů"
+ ]
+ },
+ "czechStopWords": {
+ "type": "stop",
+ "stopWords": [
+ "ks",
+ "l",
+ "litr",
+ "litry",
+ "litrů"
+ ]
+ }
+ }
+ }
+ }
+}
+
+
+
+GET products_common_grams/_analyze
+{
+ "text": ["Předchozí l Mimořádné opatření na maximum litrů ze dne 6. března 2020, č.j. MZDR 5503/2020-10/PRO ks, se ruší."],
+ "filter": [
+ "czechStopWords",
+ "customCommonGrams",
+ "czechStopWords"
+ ],
+ "tokenizer": "whitespace"
+}
+
+PUT products_word_delimiter
+{
+ "settings": {
+ "analysis": {
+ "filter": {
+ "customWordDelimiter": {
+ "type": "word_delimiter",
+ "catenate_all" : "true"
+ }
+ }
+ }
+ }
+}
+
+
+GET products_word_delimiter/_analyze
+{
+ "text": ["PlayStation PředchozíMimořádné opatření ze dne 6. března 2020, č.j. MZDR 5503/2020-10/PRO, se ruší."],
+ "filter": [
+ "customWordDelimiter"
+ ],
+ "tokenizer": "standard"
+}
+
+
+
+
+
+PUT products_analyzers
+{
+ "settings": {
+ "analysis": {
+ "filter": {
+ "customEdegeNgram": {
+ "type": "edge_ngram",
+ "min_gram": 2,
+ "max_gram": 6
+ },
+ "customSynonym": {
+ "type": "synonym",
+ "synonyms" : [
+ "PlayStation => PS",
+ "PlayStation => PSko",
+ "PlayStation => Xbox"
+ ]
+ },
+ "customStemmer": {
+ "type": "stemmer",
+ "name": "czech"
+ },
+ "customWordDelimiter": {
+ "type": "word_delimiter",
+ "catenate_all" : "true"
+ },
+ "dictionary_CZ": {
+ "type": "hunspell",
+ "locale": "cs_CZ"
+ },
+ "czechStopWords": {
+ "type": "stop",
+ "stopwords": [
+ "_czech_",
+ "ks",
+ "l",
+ "litr",
+ "litry",
+ "litrů"
+ ]
+ },
+ "customCommonGrams": {
+ "type": "common_grams",
+ "common_words": [
+ "ks",
+ "l",
+ "litr",
+ "litry",
+ "litrů"
+ ]
+ }
+ },
+ "analyzer": {
+ "czechDictionary": {
+ "filter": [
+ "lowercase",
+ "czechStopWords",
+ "dictionary_CZ",
+ "unique",
+ "asciifolding"
+ ],
+ "type": "custom",
+ "tokenizer": "standard"
+ },
+ "customEdgeNgram": {
+ "filter": [
+ "asciifolding",
+ "lowercase",
+ "stop",
+ "customEdegeNgram",
+ "unique"
+ ],
+ "type" : "custom",
+ "tokenizer" : "standard"
+ },
+ "customCommonGrams": {
+ "filter": [
+ "asciifolding",
+ "lowercase",
+ "stop",
+ "customCommonGrams",
+ "unique"
+ ],
+ "type" : "custom",
+ "tokenizer" : "standard"
+ },
+ "customWordDelimiter": {
+ "filter": [
+ "stop",
+ "customWordDelimiter",
+ "asciifolding",
+ "lowercase",
+ "unique"
+ ],
+ "type" : "custom",
+ "tokenizer" : "standard"
+ },
+ "czechSynonym": {
+ "filter": [
+ "lowercase",
+ "czechStopWords",
+ "customSynonym",
+ "unique",
+ "asciifolding"
+ ],
+ "type" : "custom",
+ "tokenizer" : "standard"
+ }
+ }
+ }
+ }
+}
+
+GET products_analyzers/_settings
+
+
+PUT products_analyzers/_mapping
+{
+ "properties": {
+ "name": {
+ "fields": {
+ "czechDictionary": {
+ "analyzer": "czechDictionary",
+ "type": "text"
+ },
+ "czechSynonym": {
+ "analyzer": "czechSynonym",
+ "type": "text"
+ },
+ "egdeNgram": {
+ "analyzer": "customEdgeNgram",
+ "type": "text"
+ },
+ "wordSplit": {
+ "analyzer": "customWordDelimiter",
+ "type": "text"
+ },
+ "wordJoin": {
+ "analyzer": "customCommonGrams",
+ "type": "text"
+ }
+ },
+ "type": "text",
+ "fielddata": true
+ }
+ }
+}
+
+
+PUT products_analyzers/_mapping
+{
+ "properties": {
+ "availability": {
+ "type": "keyword"
+ },
+ "price": {
+ "type": "long"
+ },
+ "isPublic": {
+ "type": "boolean"
+ },
+ "content": {
+ "type": "text",
+ "analyzer": "czechDictionary"
+ }
+ }
+}
+
+
+GET products_analyzers/_mapping
+
+
+GET products_analyzers/_search
+{
+ "query": {
+ "bool": {
+ "must": [
+ {
+ "multi_match": {
+ "query": "EXCIPIAL",
+ "fields": [
+ "name.czechDictionary",
+ "name.czechSynonym",
+ "name.egdeNgram",
+ "name.wordJoin",
+ "name.wordSplit"
+ ],
+ "operator": "or",
+ "type": "best_fields",
+ "fuzziness": "auto",
+ "analyzer": "czechDictionary"
+ }
+ }
+ ]
+ }
+ }
+}
+
+GET products_analyzers/_search
+{
+ "size": 100,
+ "from": 100,
+ "aggs": {
+ "coJeSkladem": {
+ "terms": {
+ "field": "availability"
+ }
+ }
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sql.csv b/sql.csv
index d26a8db..7006621 100644
--- a/sql.csv
+++ b/sql.csv
@@ -208,7 +208,6 @@ založeno výlučně na zkušenosti z dlouhodobého použití. Balen
109032,HERPESIN 50MG/G krém 5G,"
Přípravek HERPESIN KRÉM se používá při léčbě oparu rtů a obličeje. Přípravek obsahuje látku, která přednostně tlumí enzymatické pochody viru.
Léčbu zahajte ihned po objevení prvních příznaků. Mezi příznaky patří pocit napětí, pálení nebo píchání v místech, kde později dojde k výsevu oparu.
",herpesin-krem-kozni-podani-krem-1x5gm-5,10590,159.00000,2,0,0,0
109037,HYLAK FORTE perorální roztok 100ML,"Pro normální funkci trávicího ústrojí člověka je nezbytná přítomnost určitých bakterií, které osidlují převážně oblast tlustého střeva. Dokončují proces trávení, brání množení choroboplodných zárodků, produkují vitaminy B a K. Rozmanité vnější vlivy, jako je užívání antibiotik, léčba zářením, nezvyklá nebo nevhodná strava či případná infekce, narušují mikrobiální rovnováhu ve střevě a dostaví se průjem nebo zácpa, nadýmání, pocit plnosti. Užíváním přípravku Hylak forte je přirozenou cestou podpořen růst tělu prospěšných bakterií, úprava pH a tím i normální činnosti trávicího ústrojí.",hylak-forte-peroralni-roztok-1x100ml,10427,164.00000,2,0,0,0
-109037,HYLAK FORTE perorální roztok 100ML,"Pro normální funkci trávicího ústrojí člověka je nezbytná přítomnost určitých bakterií, které osidlují převážně oblast tlustého střeva. Dokončují proces trávení, brání množení choroboplodných zárodků, produkují vitaminy B a K. Rozmanité vnější vlivy, jako je užívání antibiotik, léčba zářením, nezvyklá nebo nevhodná strava či případná infekce, narušují mikrobiální rovnováhu ve střevě a dostaví se průjem nebo zácpa, nadýmání, pocit plnosti. Užíváním přípravku Hylak forte je přirozenou cestou podpořen růst tělu prospěšných bakterií, úprava pH a tím i normální činnosti trávicího ústrojí.",hylak-forte-1438240914,10427,164.00000,2,0,0,0
109038,IBALGIN BABY 100MG/5ML perorální SUS 100ML,"Používa se k tlumení mírné až středně silné bolesti (např. bolesti hlavy, uší, zubů, zad, bolesti v krku, bolesti při pohmoždění a podvrtnutí, bolesti svalů a kloubů provázející chřipková onemocnění); ke snížení horečky při chřipkových a jiných akutních infekcích, včetně horečnaté reakce po očkování.
Přípravek je určen především k léčbě dětí od 3 měsíců s tělesnou hmotností 6 kg a více.",ibalgin-baby-peroralni-suspenze-1x100ml-2gm,10403,102.00000,2,0,0,0
109039,IBALGIN DUO EFFECT 50MG/G+2MG/G krém 100G,"Ibalgin Duo Effect je určen: k léčbě poúrazových stavů a následků sportovních úrazů jako jsou: otoky a krevní podlitiny, podvrtnutí kloubu, poranění měkkých částí kloubů, k úlevě od bolesti zad.
Ibalgin Duo Effect je určen k léčbě dospělých a dospívajících od 12 let.",ibalgin-duo-effect-kozni-podani-krem-1x100gm,11224,234.00000,2,0,0,0
@@ -397,7 +396,6 @@ Přípravek PERSEN FORTE je určen pro dospělé od 18 let.",persen-forte-perora
109273,PIRABENE 800MG potahované tablety 100,"Pirabene obsahuje léčivou látku piracetam. Tato látka příznivě ovlivňuje funkci mozkových buněk v oblasti učení a paměti, bdělosti a vědomí. U pacientů s nedostatečnými funkcemi centrálního nervového systému zvyšuje krátkodobé i dlouhodobé podávání piracetamu bdělost a zlepšuje poznávací schopnosti.
Pirabene může být podáván dospělým, dospívajícím a dětem od 8 let. Dětem se srpkovitou anemií může být podáván od 3 let.",pirabene-800-mg-peroralni-potahovane-tablety-100x800mg,10758,187.00000,2,0,0,0
109274,PIRACETAM AL 1200 1200MG potahované tablety 30,"Piracetam se používá ke zlepšení mozkových funkcí, k léčbě příznaků chronického zhoršení funkcí mozku jako součást celkové léčby u syndromů demence (zhoršení nebo ztráta získaných rozumových dovedností), jejichž hlavními příznaky jsou poruchy paměti, zhoršení schopnosti koncentrace, poruchy myšlení, předčasná únavnost, nedostatek vůle, elánu a motivace a poruchy nálady.",piracetam-al-1200-peroralni-potahovane-tablety-30x1200mg,11150,97.00000,2,0,0,0
109275,PIRACETAM AL 1200 1200MG potahované tablety 60,"Piracetam se používá ke zlepšení mozkových funkcí, k léčbě příznaků chronického zhoršení funkcí mozku jako součást celkové léčby u syndromů demence (zhoršení nebo ztráta získaných rozumových dovedností), jejichž hlavními příznaky jsou: poruchy paměti, zhoršení schopnosti koncentrace, poruchy myšlení, předčasná únavnost, nedostatek vůle, elánu a motivace a poruchy nálady.",piracetam-al-1200-peroralni-potahovane-tablety-60x1200mg,10463,228.00000,1,0,0,0
-109275,PIRACETAM AL 1200 1200MG potahované tablety 60,"Piracetam se používá ke zlepšení mozkových funkcí, k léčbě příznaků chronického zhoršení funkcí mozku jako součást celkové léčby u syndromů demence (zhoršení nebo ztráta získaných rozumových dovedností), jejichž hlavními příznaky jsou: poruchy paměti, zhoršení schopnosti koncentrace, poruchy myšlení, předčasná únavnost, nedostatek vůle, elánu a motivace a poruchy nálady.",piracetam-al-1200-peroralni-potahovane-tablety-60,10463,228.00000,1,0,0,0
109276,PIRACETAM AL 800 800MG potahované tablety 100,"Piracetam se používá ke zlepšení mozkových funkcí, k léčbě příznaků chronického zhoršení funkcí mozku jako součást celkové léčby u syndromů demence (zhoršení nebo ztráta získaných rozumových dovedností), jejichž hlavními příznaky jsou: poruchy paměti, zhoršení schopnosti koncentrace, poruchy myšlení, předčasná únavnost, nedostatek vůle, elánu a motivace a poruchy nálady.",piracetam-al-800-peroralni-potahovane-tablety-100x800mg,11326,205.00000,1,0,0,0
109277,PIRACETAM AL 800 800MG potahované tablety 30,"Piracetam se používá ke zlepšení mozkových funkcí, k léčbě příznaků chronického zhoršení funkcí mozku jako součást celkové léčby u syndromů demence (zhoršení nebo ztráta získaných rozumových dovedností), jejichž hlavními příznaky jsou: poruchy paměti, zhoršení schopnosti koncentrace, poruchy myšlení, předčasná únavnost, nedostatek vůle, elánu a motivace a poruchy nálady.",piracetam-al-800-peroralni-potahovane-tablety-30x800mg,4571,81.00000,2,0,0,0
109278,PIRACETAM AL 800 800MG potahované tablety 60,"Piracetam se používá ke zlepšení mozkových funkcí, k léčbě příznaků chronického zhoršení funkcí mozku jako součást celkové léčby u syndromů demence (zhoršení nebo ztráta získaných rozumových dovedností), jejichž hlavními příznaky jsou: poruchy paměti, zhoršení schopnosti koncentrace, poruchy myšlení, předčasná únavnost, nedostatek vůle, elánu a motivace a poruchy nálady.",piracetam-al-800-peroralni-potahovane-tablety-60x800mg,11159,134.00000,1,0,0,0