···
481
481
// bytes should work fine, as we're just computing a ratio.
482
482
fileLength := float64(d.boundaries[doc+1] - d.boundaries[doc])
483
483
numFiles := len(d.boundaries)
484
484
-
averageFileLength := float64(d.boundaries[numFiles - 1]) / float64(numFiles)
484
484
+
averageFileLength := float64(d.boundaries[numFiles-1]) / float64(numFiles)
485
485
L := fileLength / averageFileLength
486
486
487
487
// Use standard parameter defaults (used in Lucene and academic papers)
···
491
491
for _, freq := range termFreqs {
492
492
tf := float64(freq)
493
493
sumTf += tf
494
494
-
score += ((k + 1.0) * tf) / (k * (1.0 - b + b * L) + tf)
494
494
+
score += ((k + 1.0) * tf) / (k*(1.0-b+b*L) + tf)
495
495
}
496
496
497
497
fileMatch.addKeywordScore(score, sumTf, L, opts.DebugScore)
···
370
370
}
371
371
372
372
want := map[string][]string{
373
373
-
"f1": []string{"foo", "quz"},
374
374
-
"f2": []string{"foo", "foo-2"},
373
373
+
"f1": {"foo", "quz"},
374
374
+
"f2": {"foo", "foo-2"},
375
375
}
376
376
377
377
if len(sr.Files) != 2 {