summaryrefslogtreecommitdiff
path: root/scoring
diff options
context:
space:
mode:
authoralex <[email protected]>2026-07-28 17:37:06 +0200
committeralex <[email protected]>2026-07-28 17:37:06 +0200
commitc91c3afd8700138f8eb8a25a4ae422c2c9e46cea (patch)
treefd9b5ea4f3b821581b2ceb4e7fa8afc1a84c0eeb /scoring
parent5858d34b8ab573e18a4f6ddc5ee962b24ea269dc (diff)
downloadsearch-engine-c91c3afd8700138f8eb8a25a4ae422c2c9e46cea.tar.xz
search-engine-c91c3afd8700138f8eb8a25a4ae422c2c9e46cea.zip
refactored entire code base to be in the package core so i can later implement interfaces to interact with the engine
Diffstat (limited to 'scoring')
-rw-r--r--scoring/field.go10
-rw-r--r--scoring/idf.go17
2 files changed, 0 insertions, 27 deletions
diff --git a/scoring/field.go b/scoring/field.go
deleted file mode 100644
index d84ab3b..0000000
--- a/scoring/field.go
+++ /dev/null
@@ -1,10 +0,0 @@
-package scoring
-
-import "searchEngine/index"
-
-var TitleWeight = 5.0
-var BodyWeight = 1.0
-
-func FieldScore(p index.Posting) float64 {
- return (float64(p.TitleCount) * TitleWeight) + (float64(p.BodyCount) * BodyWeight)
-}
diff --git a/scoring/idf.go b/scoring/idf.go
deleted file mode 100644
index 5c85ba3..0000000
--- a/scoring/idf.go
+++ /dev/null
@@ -1,17 +0,0 @@
-package scoring
-
-import (
- "math"
- "searchEngine/index"
-)
-
-func CalculateIDF(totalDocs int, docFrequency int) float64 {
- if docFrequency == 0 {
- return 0.0
- }
- return math.Log10(float64(totalDocs) / float64(docFrequency))
-}
-func ScoreTFIDF(p index.Posting, idf float64) float64 {
-
- return FieldScore(p) * idf
-}