Fix bug on elastic search (#12811)

* Fix bug on elastic search

* Add more comments for elastic search result startIndex and endIndex

* refactor indexPos

* refactor indexPos

* Fix bug
This commit is contained in:
2020-09-12 20:31:52 +08:00
committed by GitHub
parent ae528d8321
commit 8ce10fb6e1
2 changed files with 42 additions and 15 deletions

View File

@ -34,3 +34,9 @@ func TestESIndexAndSearch(t *testing.T) {
testIndexer("elastic_search", t, indexer)
}
func TestIndexPos(t *testing.T) {
startIdx, endIdx := indexPos("test index start and end", "start", "end")
assert.EqualValues(t, 11, startIdx)
assert.EqualValues(t, 24, endIdx)
}