Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
MetaGer
Commits
e6aefdad
Commit
e6aefdad
authored
Oct 14, 2019
by
Aria
Browse files
only query parts which are not inside of phrase searches will be checked for stopwords
parent
15c8db31
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/MetaGer.php
View file @
e6aefdad
...
...
@@ -1098,6 +1098,7 @@ class MetaGer
$tmp
=
$match
[
1
]
.
$match
[
3
];
$this
->
phrases
[]
=
$match
[
2
];
}
foreach
(
$this
->
phrases
as
$phrase
)
{
$p
.
=
"
\"
$phrase
\"
, "
;
}
...
...
@@ -1197,8 +1198,16 @@ class MetaGer
private
function
searchCheckStopwords
(
$request
)
{
$oldQ
=
$this
->
q
;
$tmp
=
$this
->
q
;
// matches '[... ]"test satz"[ ...]'
// In order to avoid "finding" stopwords inside of phrase searches only strings outside of quotation marks should be checked
while
(
preg_match
(
"/(^|.*?\s)
\"
(.+)
\"
(\s.*|$)/si"
,
$tmp
,
$match
))
{
$tmp
=
$match
[
1
]
.
$match
[
3
];
}
// matches '[... ]-test[ ...]'
$words
=
preg_split
(
"/\s+/si"
,
$t
his
->
q
);
$words
=
preg_split
(
"/\s+/si"
,
$t
mp
);
$newQ
=
""
;
foreach
(
$words
as
$word
)
{
if
(
strpos
(
$word
,
"-"
)
===
0
&&
strlen
(
$word
)
>
1
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment