From 8c783df30029a70e1838d8ae7ac5ddc1dbf868f2 Mon Sep 17 00:00:00 2001 From: Simon Let Date: Fri, 28 Feb 2020 19:01:05 +0100 Subject: [PATCH] improve resh cli search scoring reduce penalty for nonzero exit code penalty won't cause the records to not show up --- cmd/cli/main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/cli/main.go b/cmd/cli/main.go index 87e1c18..02dfd41 100644 --- a/cmd/cli/main.go +++ b/cmd/cli/main.go @@ -293,11 +293,12 @@ func newItemFromRecordForQuery(record records.EnrichedRecord, query query, debug const hitScoreConsecutive = 0.1 const properMatchScore = 0.3 const actualPwdScore = 0.9 - const actualPwdScoreExtra = 0.2 + const actualPwdScoreExtra = 0.2 // this + hitScore > actualPwdScore + const nonZeroExitCodeScorePenalty = 0.8 // this < min(hitScore, actualPwdScore) hits := 0.0 if record.ExitCode != 0 { - hits-- + hits -= nonZeroExitCodeScorePenalty } cmd := record.CmdLine pwdTilde := strings.Replace(record.Pwd, record.Home, "~", 1)