Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
open-source
MetaGer
Commits
e6aefdad
Commit
e6aefdad
authored
Oct 14, 2019
by
Aria
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
app/MetaGer.php
app/MetaGer.php
+10
-1
No files found.
app/MetaGer.php
View file @
e6aefdad
...
@@ -1098,6 +1098,7 @@ class MetaGer
...
@@ -1098,6 +1098,7 @@ class MetaGer
$tmp
=
$match
[
1
]
.
$match
[
3
];
$tmp
=
$match
[
1
]
.
$match
[
3
];
$this
->
phrases
[]
=
$match
[
2
];
$this
->
phrases
[]
=
$match
[
2
];
}
}
foreach
(
$this
->
phrases
as
$phrase
)
{
foreach
(
$this
->
phrases
as
$phrase
)
{
$p
.
=
"
\"
$phrase
\"
, "
;
$p
.
=
"
\"
$phrase
\"
, "
;
}
}
...
@@ -1197,8 +1198,16 @@ class MetaGer
...
@@ -1197,8 +1198,16 @@ class MetaGer
private
function
searchCheckStopwords
(
$request
)
private
function
searchCheckStopwords
(
$request
)
{
{
$oldQ
=
$this
->
q
;
$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[ ...]'
// matches '[... ]-test[ ...]'
$words
=
preg_split
(
"/\s+/si"
,
$t
his
->
q
);
$words
=
preg_split
(
"/\s+/si"
,
$t
mp
);
$newQ
=
""
;
$newQ
=
""
;
foreach
(
$words
as
$word
)
{
foreach
(
$words
as
$word
)
{
if
(
strpos
(
$word
,
"-"
)
===
0
&&
strlen
(
$word
)
>
1
)
{
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