summaryrefslogtreecommitdiffstats
path: root/vendor/gopkg.in/olivere/elastic.v5/highlight_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gopkg.in/olivere/elastic.v5/highlight_test.go')
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/highlight_test.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/vendor/gopkg.in/olivere/elastic.v5/highlight_test.go b/vendor/gopkg.in/olivere/elastic.v5/highlight_test.go
index 9687cfb79..c7b972c44 100644
--- a/vendor/gopkg.in/olivere/elastic.v5/highlight_test.go
+++ b/vendor/gopkg.in/olivere/elastic.v5/highlight_test.go
@@ -117,8 +117,10 @@ func TestHighlighterWithExplicitFieldOrder(t *testing.T) {
}
}
-func TestHighlightWithBoundaryChars(t *testing.T) {
- builder := NewHighlight().BoundaryChars(" \t\r")
+func TestHighlightWithBoundarySettings(t *testing.T) {
+ builder := NewHighlight().
+ BoundaryChars(" \t\r").
+ BoundaryScannerType("word")
src, err := builder.Source()
if err != nil {
t.Fatal(err)
@@ -128,7 +130,7 @@ func TestHighlightWithBoundaryChars(t *testing.T) {
t.Fatalf("marshaling to JSON failed: %v", err)
}
got := string(data)
- expected := `{"boundary_chars":" \t\r"}`
+ expected := `{"boundary_chars":" \t\r","boundary_scanner":"word"}`
if got != expected {
t.Errorf("expected\n%s\n,got:\n%s", expected, got)
}
@@ -142,17 +144,17 @@ func TestHighlightWithTermQuery(t *testing.T) {
tweet3 := tweet{User: "sandrae", Message: "Cycling is fun to do."}
// Add all documents
- _, err := client.Index().Index(testIndexName).Type("tweet").Id("1").BodyJson(&tweet1).Do(context.TODO())
+ _, err := client.Index().Index(testIndexName).Type("doc").Id("1").BodyJson(&tweet1).Do(context.TODO())
if err != nil {
t.Fatal(err)
}
- _, err = client.Index().Index(testIndexName).Type("tweet").Id("2").BodyJson(&tweet2).Do(context.TODO())
+ _, err = client.Index().Index(testIndexName).Type("doc").Id("2").BodyJson(&tweet2).Do(context.TODO())
if err != nil {
t.Fatal(err)
}
- _, err = client.Index().Index(testIndexName).Type("tweet").Id("3").BodyJson(&tweet3).Do(context.TODO())
+ _, err = client.Index().Index(testIndexName).Type("doc").Id("3").BodyJson(&tweet3).Do(context.TODO())
if err != nil {
t.Fatal(err)
}