Skip to content

Commit eaf7547

Browse files
committed
add comments, reorder prints, add default value for REDIS_MAJOR_VERSION
1 parent c2b8c63 commit eaf7547

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

main_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,15 @@ var _ = BeforeSuite(func() {
9393
RCEDocker, _ = strconv.ParseBool(os.Getenv("RCE_DOCKER"))
9494

9595
REDIS_MAJOR_VERSION, _ = strconv.Atoi(os.Getenv("REDIS_MAJOR_VERSION"))
96+
if REDIS_MAJOR_VERSION == 0 {
97+
REDIS_MAJOR_VERSION = 7
98+
}
9699
Expect(REDIS_MAJOR_VERSION).To(BeNumerically(">=", 6))
97100
Expect(REDIS_MAJOR_VERSION).To(BeNumerically("<=", 8))
98101

99102
fmt.Printf("RECluster: %v\n", RECluster)
100-
fmt.Printf("REDIS_MAJOR_VERSION: %v\n", REDIS_MAJOR_VERSION)
101103
fmt.Printf("RCEDocker: %v\n", RCEDocker)
104+
fmt.Printf("REDIS_MAJOR_VERSION: %v\n", REDIS_MAJOR_VERSION)
102105
if !RECluster && !RCEDocker {
103106

104107
redisMain, err = startRedis(redisPort)

search_test.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,11 @@ var _ = Describe("RediSearch commands Resp 2", Label("search"), func() {
371371
Expect(names).To(ContainElement("John"))
372372
})
373373

374-
// in redis 8, the default scorer is changed BM25
374+
// up until redis 8 the default scorer was TFIDF, in redis 8 it is BM25
375+
// this test expect redis major version >= 8
375376
It("should FTSearch WithScores", Label("search", "ftsearch"), func() {
376377
if REDIS_MAJOR_VERSION < 8 {
377-
Skip("default scorer is not BM25")
378+
Skip("(redis major version < 8) default scorer is not BM25")
378379
}
379380
text1 := &redis.FieldSchema{FieldName: "description", FieldType: redis.SearchFieldTypeText}
380381
val, err := client.FTCreate(ctx, "idx1", &redis.FTCreateOptions{}, text1).Result()
@@ -414,9 +415,11 @@ var _ = Describe("RediSearch commands Resp 2", Label("search"), func() {
414415
Expect(*res.Docs[0].Score).To(BeEquivalentTo(float64(0)))
415416
})
416417

418+
// up until redis 8 the default scorer was TFIDF, in redis 8 it is BM25
419+
// this test expect redis major version <=7
417420
It("should FTSearch WithScores", Label("search", "ftsearch"), func() {
418-
if REDIS_MAJOR_VERSION >= 8 {
419-
Skip("default scorer is not TFIDF")
421+
if REDIS_MAJOR_VERSION > 7 {
422+
Skip("(redis major version > 7) default scorer is not TFIDF")
420423
}
421424
text1 := &redis.FieldSchema{FieldName: "description", FieldType: redis.SearchFieldTypeText}
422425
val, err := client.FTCreate(ctx, "idx1", &redis.FTCreateOptions{}, text1).Result()

0 commit comments

Comments
 (0)