Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MetaGer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
MetaGer
Commits
130f3122
Commit
130f3122
authored
8 years ago
by
Dominik Hebeler
Browse files
Options
Downloads
Plain Diff
Merge branch '447-yandex-filter' into 'development'
Yandex Filter eingebaut Closes
#447
See merge request
!740
parents
1c7809d7
24fdba2d
No related branches found
Branches containing commit
No related tags found
1 merge request
!1365
Resolve "Filter Options for MetaGer"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/Models/Result.php
+38
-0
38 additions, 0 deletions
app/Models/Result.php
with
38 additions
and
0 deletions
app/Models/Result.php
+
38
−
0
View file @
130f3122
...
...
@@ -87,9 +87,47 @@ class Result
$rank
*=
floatval
(
$this
->
engineBoost
);
}
# Runter Ranken von Yandex Ergebnissen mit zu viel kyrillischen Texten
if
(
stripos
(
$this
->
gefVon
,
"yandex"
)
!==
false
)
{
$rank
-=
$this
->
calcYandexBoost
(
$eingabe
);
}
$this
->
rank
=
$rank
;
}
# Berechnet, ob dieses Suchergebnis einen Malus erhalten soll, oder nicht
# Übergeben werden alle Yandex Ergebnisse
# Wenn die Suchworte kein kyrillisches Zeichen enthalten, wird das Ergebnis schlechter bewertet,
# falls es selbst zu viele kyrillische Zeichen enthält
private
function
calcYandexBoost
(
$tmpEingabe
)
{
$maxRatio
=
0.1
;
# Gibt den Prozentsatz von Kyrillischen Zeichen in Titel und Beschreibung an, ab dem das Ergebnis runter gerankt werden soll
if
(
preg_match
(
'/[А-Яа-яЁё]/u'
,
$tmpEingabe
)
===
1
)
{
# Das Suchwort enthält kyrillische Zeichen, also dürfen es auch die Ergebnisse
return
0
;
}
else
{
# Wir überprüfen das Verhältnis von Kyrillischen Zeichen im Titel
if
(
preg_match_all
(
'/[А-Яа-яЁё]/u'
,
$this
->
titel
,
$matches
))
{
$count
=
sizeof
(
$matches
[
0
]);
$titleSize
=
strlen
(
$this
->
titel
);
$percKyr
=
$count
/
$titleSize
;
if
(
$percKyr
>
$maxRatio
)
{
return
5
;
}
}
# Wir überprüfen das Verhältnis von Kyrillischen Zeichen in der Beschreibung
if
(
preg_match_all
(
'/[А-Яа-яЁё]/u'
,
$this
->
descr
,
$matches
))
{
$count
=
sizeof
(
$matches
[
0
]);
$descrSize
=
strlen
(
$this
->
descr
);
$percKyr
=
$count
/
$descrSize
;
if
(
$percKyr
>
$maxRatio
)
{
return
5
;
}
}
}
return
0
;
}
# Berechnet den Ranking-Boost durch ??? URL
public
function
calcURLBoost
(
$tmpEingabe
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment