2019-12-09 00:45:35 +05:30
|
|
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
2022-11-27 23:50:29 +05:30
|
|
|
// SPDX-License-Identifier: MIT
|
2019-12-09 00:45:35 +05:30
|
|
|
|
|
|
|
package code
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2021-11-12 20:06:47 +05:30
|
|
|
"code.gitea.io/gitea/models/unittest"
|
2019-12-23 18:01:16 +05:30
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2019-12-09 00:45:35 +05:30
|
|
|
)
|
|
|
|
|
2020-08-30 21:38:01 +05:30
|
|
|
func TestBleveIndexAndSearch(t *testing.T) {
|
2021-11-12 20:06:47 +05:30
|
|
|
unittest.PrepareTestEnv(t)
|
2019-12-23 18:01:16 +05:30
|
|
|
|
2022-09-04 20:44:53 +05:30
|
|
|
dir := t.TempDir()
|
2019-12-23 18:01:16 +05:30
|
|
|
|
|
|
|
idx, _, err := NewBleveIndexer(dir)
|
|
|
|
if err != nil {
|
2020-08-30 21:38:01 +05:30
|
|
|
assert.Fail(t, "Unable to create bleve indexer Error: %v", err)
|
2019-12-28 07:38:05 +05:30
|
|
|
if idx != nil {
|
|
|
|
idx.Close()
|
|
|
|
}
|
|
|
|
return
|
2019-12-23 18:01:16 +05:30
|
|
|
}
|
2019-12-28 07:38:05 +05:30
|
|
|
defer idx.Close()
|
2019-12-23 18:01:16 +05:30
|
|
|
|
2020-08-30 21:38:01 +05:30
|
|
|
testIndexer("beleve", t, idx)
|
2019-12-23 18:01:16 +05:30
|
|
|
}
|