Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
fetchKeywords example
$tokens
=
$this
->tokenFilter->
filter
(
$tokens
,
$context
)
;
if
(
empty
(
$tokens
)
)
{
return
new
SearchPattern
(
new
SearchTerm
(
''
)
)
;
}
$tokenSlops
=
$this
->
slop
(
$tokens
)
;
if
(
!
$this
->
checkSlops
(
array_values
(
$tokenSlops
)
)
)
{
return
new
SearchPattern
(
new
SearchTerm
(
$word
)
)
;
}
$tokenKeywords
=
$this
->
fetchKeywords
(
$context
,
$tokenSlops
)
;
$matches
=
array_fill
(
0, \
count
(
$tokens
)
,
[
]
)
;
$matches
=
$this
->
groupTokenKeywords
(
$matches
,
$tokenKeywords
)
;
$combines
=
$this
->
permute
(
$tokens
)
;
foreach
(
$combines
as
$token
)
{
$tokens
[
]
=
$token
;
}
/** @var list<string> $tokens */
$tokens
=
array_keys
(
array_flip
(
$tokens
)
)
;