Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suggestible
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Suggestible
Commits
b8e4d31f
Commit
b8e4d31f
authored
4 months ago
by
Phil Höfer
Browse files
Options
Downloads
Patches
Plain Diff
Fix 7 warnings
parent
e594be9d
No related branches found
No related tags found
No related merge requests found
Pipeline
#10818
passed
4 months ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/predictors/benchmark.rs
+5
-6
5 additions, 6 deletions
src/predictors/benchmark.rs
with
5 additions
and
6 deletions
src/predictors/benchmark.rs
+
5
−
6
View file @
b8e4d31f
...
...
@@ -92,7 +92,7 @@ impl<P:Predictor> Predictor for BenchmarkingPredictor<P> {
fn
update_from_importer
<
I
:
Importer
>
(
&
mut
self
,
importer
:
&
mut
I
,
count
:
usize
)
->
Result
<
usize
,
Box
<
dyn
std
::
error
::
Error
>>
{
let
mut
raw_list
=
String
::
new
()
;
let
raw_list
:
String
;
let
blocklist
:
Vec
<&
str
>
=
match
self
.configuration
.get
(
"blocklist"
)
{
Some
(
list
)
=>
{
match
fs
::
read_to_string
(
list
)
{
...
...
@@ -121,10 +121,9 @@ impl<P:Predictor> Predictor for BenchmarkingPredictor<P> {
let
data
=
importer
.fetch_queries
(
count
)
?
;
println!
(
"got {} queries from the importer."
,
data
.len
());
let
mut
count
=
0
;
let
mut
start_time
=
SystemTime
::
now
();
for
q
in
data
.iter
()
{
if
(
!
re
.is_match
(
&
q
.query
)
)
{
self
.update_from_query
(
&
q
.query
.as_str
(),
None
);
if
false
&&
!
re
.is_match
(
&
q
.query
)
{
let
_
=
self
.update_from_query
(
&
q
.query
.as_str
(),
None
);
}
count
+=
1
;
// if count%100 == 0 {
...
...
@@ -136,7 +135,7 @@ impl<P:Predictor> Predictor for BenchmarkingPredictor<P> {
fn
update_from_query
(
&
mut
self
,
query
:
&
str
,
blocklist
:
Option
<&
Vec
<&
str
>>
)
->
Result
<
(),
Box
<
dyn
std
::
error
::
Error
>>
{
if
(
query
.len
()
>
3
)
{
if
query
.len
()
>
3
{
self
.total_queries
+=
1
;
let
trunc_query
=
&
query
.chars
()
.take
(
query
.len
()
.saturating_sub
(
3
))
.collect
::
<
String
>
();
let
prediction
=
self
.predictor
.predict
(
trunc_query
,
5
);
...
...
@@ -152,7 +151,7 @@ impl<P:Predictor> Predictor for BenchmarkingPredictor<P> {
}
}
self
.predictor
.update_from_query
(
query
,
blocklist
);
let
_
=
self
.predictor
.update_from_query
(
query
,
blocklist
);
Ok
(())
}
...
...
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