aboutsummaryrefslogtreecommitdiff
path: root/src/index.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.rs')
-rw-r--r--src/index.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/index.rs b/src/index.rs
index 5d2abb6..d3aab9e 100644
--- a/src/index.rs
+++ b/src/index.rs
@@ -149,6 +149,7 @@ impl Index {
let opt = FileVector::from_hashmap(opt);
let mut results : Vec<SearchResult> = Vec::new();
+ let max = self.filecache.len();
let mut last_p = 0;
for (i, filecache) in self.filecache.iter().enumerate() {
@@ -159,7 +160,7 @@ impl Index {
results.push(r);
}
- let p = i * 100 / self.filecache.len();
+ let p = i * 100 / max;
if last_p < p {
callback(p as u8);
last_p = p;