Skip to content

Commit e4d70ec

Browse files
add NO-HIGHLIGHT test
1 parent 989f1ed commit e4d70ec

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

redisearch/schema_test.go

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func TestSchema_AddField(t *testing.T) {
124124
func TestSchema_SkipInitialScan(t *testing.T) {
125125
c := createClient("skip-initial-scan-test")
126126
flush(c)
127-
127+
128128
vanillaConnection := c.pool.Get()
129129
_, err := vanillaConnection.Do("HSET", "create-index-info:doc1", "name", "Jon", "age", 25)
130130
assert.Nil(t, err)
@@ -148,3 +148,23 @@ func TestSchema_SkipInitialScan(t *testing.T) {
148148
assert.Nil(t, err)
149149
assert.Equal(t, 0, total)
150150
}
151+
152+
func TestSchema_SummarizationDisabled(t *testing.T) {
153+
doc := NewDocument("TestSchema-doc1", 1.0).Set("body", "foo bar")
154+
155+
c := createClient("summarize-disable-no-term-offsets-test")
156+
flush(c)
157+
schema := NewSchema(Options{NoOffsetVectors: true}).AddField(NewTextField("body"))
158+
c.CreateIndexWithIndexDefinition(schema, NewIndexDefinition())
159+
assert.Nil(t, c.IndexOptions(DefaultIndexingOptions, doc))
160+
_, _, err := c.Search(NewQuery("body").Summarize())
161+
assert.NotNil(t, err)
162+
163+
c = createClient("summarize-disable-no-highlights-test")
164+
flush(c)
165+
schema = NewSchema(Options{NoHighlights: true}).AddField(NewTextField("body"))
166+
c.CreateIndexWithIndexDefinition(schema, NewIndexDefinition())
167+
assert.Nil(t, c.IndexOptions(DefaultIndexingOptions, doc))
168+
_, _, err = c.Search(NewQuery("body").Summarize())
169+
assert.NotNil(t, err)
170+
}

0 commit comments

Comments
 (0)