Skip to content
This repository was archived by the owner on Oct 13, 2021. It is now read-only.

align the way to calculate hash #94

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ func (engine *Engine) internalIndexDoc(docId string, data types.DocData,
atomic.AddUint64(&engine.numForceUpdatingReqs, 1)
}

hash := murmur.Sum32(fmt.Sprintf("%s%s", docId, data.Content))
hash := murmur.Sum32(docId)
engine.segmenterChan <- segmenterReq{
docId: docId, hash: hash, data: data, forceUpdate: forceUpdate}
}
Expand Down
6 changes: 3 additions & 3 deletions engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@ func TestFrequenciesIndex(t *testing.T) {
tt.Expect(t, "2", len(outDocs))

tt.Expect(t, "1", outDocs[0].DocId)
tt.Expect(t, "2374", int(outDocs[0].Scores[0]*1000))
tt.Expect(t, "2387", int(outDocs[0].Scores[0]*1000))

tt.Expect(t, "5", outDocs[1].DocId)
tt.Expect(t, "2133", int(outDocs[1].Scores[0]*1000))
tt.Expect(t, "2205", int(outDocs[1].Scores[0]*1000))

engine.Close()
}
Expand Down Expand Up @@ -706,7 +706,7 @@ func TestSearchNotUseGse(t *testing.T) {
tt.Expect(t, "2", len(outDocs))

tt.Expect(t, "8", outDocs[0].DocId)
tt.Expect(t, "3736", int(outDocs[0].Scores[0]*1000))
tt.Expect(t, "3999", int(outDocs[0].Scores[0]*1000))
tt.Expect(t, "[]", outDocs[0].TokenSnippetLocs)

outputs1 := engine1.Search(types.SearchReq{
Expand Down
4 changes: 2 additions & 2 deletions riot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ func TestEngineIndexWithNewStore(t *testing.T) {
tt.Expect(t, "2", len(outDocs))

// tt.Expect(t, "2", outDocs[0].DocId)
tt.Expect(t, "2500", int(outDocs[0].Scores[0]*1000))
tt.Expect(t, "2531", int(outDocs[0].Scores[0]*1000))
tt.Expect(t, "[]", outDocs[0].TokenSnippetLocs)

// tt.Expect(t, "1", outDocs[1].DocId)
tt.Expect(t, "2215", int(outDocs[1].Scores[0]*1000))
tt.Expect(t, "2000", int(outDocs[1].Scores[0]*1000))
tt.Expect(t, "[]", outDocs[1].TokenSnippetLocs)

engine1.Close()
Expand Down