move intent an config value into config files
This commit is contained in:
204
src/Config/SearchRepairConfig.php
Normal file
204
src/Config/SearchRepairConfig.php
Normal file
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Config;
|
||||
|
||||
final class SearchRepairConfig
|
||||
{
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getMaxRepairQueries(): int
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
public function getMinPrimaryResultsWithoutRepair(): int
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public function getTopProductLogLimit(): int
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
public function getModelCandidatePattern(): string
|
||||
{
|
||||
return '/\b([A-Za-zÄÖÜäöüß][A-Za-zÄÖÜäöüß®\-]*(?:\s+[A-Za-zÄÖÜäöüß][A-Za-zÄÖÜäöüß®\-]*){0,2}\s+\d{2,5}[A-Za-z0-9\-]*)\b/u';
|
||||
}
|
||||
|
||||
public function getAccessoryCandidatePattern(): string
|
||||
{
|
||||
return '/\b((?:' . implode('|', $this->getAccessoryCandidateTerms()) . ')\s+\d{1,5}[A-Za-z0-9\-]*)\b/iu';
|
||||
}
|
||||
|
||||
public function getAccessoryOrBundlePattern(): string
|
||||
{
|
||||
return '/\b(' . implode('|', $this->getAccessoryOrBundleTerms()) . ')\b/iu';
|
||||
}
|
||||
|
||||
public function getModelLikePattern(): string
|
||||
{
|
||||
return '/\b[A-Za-zÄÖÜäöüß][A-Za-zÄÖÜäöüß®\-]*(?:\s+[A-Za-zÄÖÜäöüß][A-Za-zÄÖÜäöüß®\-]*){0,2}\s+\d{2,5}[A-Za-z0-9\-]*\b/u';
|
||||
}
|
||||
|
||||
public function getSpecificityBoostPattern(): string
|
||||
{
|
||||
return '/\b(?:' . implode('|', $this->getSpecificityBoostTerms()) . ')\b/iu';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getGenericCandidateTokens(): array
|
||||
{
|
||||
return [
|
||||
'wasser',
|
||||
'messgerät',
|
||||
'messgeraet',
|
||||
'produkt',
|
||||
'geräte',
|
||||
'geraete',
|
||||
'gerät',
|
||||
'geraet',
|
||||
'resthärte',
|
||||
'resthaerte',
|
||||
'preis',
|
||||
'infos',
|
||||
'wissen',
|
||||
];
|
||||
}
|
||||
|
||||
public function getSanitizeTrimCharacters(): string
|
||||
{
|
||||
return " \t\n\r\0\x0B\"'`.,;:-";
|
||||
}
|
||||
|
||||
public function getContainsDigitPattern(): string
|
||||
{
|
||||
return '/\d/u';
|
||||
}
|
||||
|
||||
public function getWhitespaceCollapsePattern(): string
|
||||
{
|
||||
return '/\s+/u';
|
||||
}
|
||||
|
||||
public function getTokenizeCleanupPattern(): string
|
||||
{
|
||||
return '/[^\p{L}\p{N}\s\-]+/u';
|
||||
}
|
||||
|
||||
public function getProductKeySeparator(): string
|
||||
{
|
||||
return '|';
|
||||
}
|
||||
|
||||
public function getCandidateDigitScore(): int
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public function getCandidateWordCountCap(): int
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public function getSpecificityBoostScore(): int
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
public function getPrimaryQueryOverlapThreshold(): float
|
||||
{
|
||||
return 0.9;
|
||||
}
|
||||
|
||||
public function getPromptMatchWeight(): int
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
public function getPrimaryQueryMatchWeight(): int
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public function getRepairSignalMatchWeight(): int
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public function getPrimaryResultOrderBonus(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function getTokenIntersectionScore(): int
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public function getNumericTokenMatchScore(): int
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getAccessoryCandidateTerms(): array
|
||||
{
|
||||
return [
|
||||
'indikator',
|
||||
'indicator',
|
||||
'reagenz',
|
||||
'reagent',
|
||||
'kit',
|
||||
'set',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getAccessoryOrBundleTerms(): array
|
||||
{
|
||||
return [
|
||||
'passend',
|
||||
'passende',
|
||||
'zubehor',
|
||||
'zubehör',
|
||||
'dazu',
|
||||
'zusatz',
|
||||
'erganzung',
|
||||
'ergänzung',
|
||||
'indikator',
|
||||
'reagenz',
|
||||
'kit',
|
||||
'set',
|
||||
'auch\s+das',
|
||||
'mit\s+preis\s+und\s+allen\s+infos',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getSpecificityBoostTerms(): array
|
||||
{
|
||||
return [
|
||||
'indikator',
|
||||
'indicator',
|
||||
'testomat',
|
||||
'tritromat',
|
||||
'titromat',
|
||||
'reagenz',
|
||||
'reagent',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user