diff options
| author | alex <[email protected]> | 2026-07-28 17:37:06 +0200 |
|---|---|---|
| committer | alex <[email protected]> | 2026-07-28 17:37:06 +0200 |
| commit | c91c3afd8700138f8eb8a25a4ae422c2c9e46cea (patch) | |
| tree | fd9b5ea4f3b821581b2ceb4e7fa8afc1a84c0eeb /core/scoring/field.go | |
| parent | 5858d34b8ab573e18a4f6ddc5ee962b24ea269dc (diff) | |
| download | search-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 'core/scoring/field.go')
| -rw-r--r-- | core/scoring/field.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/core/scoring/field.go b/core/scoring/field.go new file mode 100644 index 0000000..89f6132 --- /dev/null +++ b/core/scoring/field.go @@ -0,0 +1,10 @@ +package scoring + +import "searchEngine/core/index" + +var TitleWeight = 5.0 +var BodyWeight = 1.0 + +func FieldScore(p index.Posting) float64 { + return (float64(p.TitleCount) * TitleWeight) + (float64(p.BodyCount) * BodyWeight) +} |
