Files
Florian Schade bd4287762e fix(search): answer the same on both engines
both engines now agree on names, titles, tags, paths, types, sizes, dates,
hidden flags, facet values and wildcards. quotes only delimit phrases and
the equals operator matches the whole field value, following the kql spec.
the index name carries a generation so a changed mapping starts on a fresh
index, MIGRATION.md says how to fill it.
2026-08-31 10:44:03 +02:00

41 lines
745 B
Go

package opensearchtest
import (
"embed"
"encoding/json"
"fmt"
"path"
"github.com/opencloud-eu/opencloud/services/search/pkg/search"
)
//go:embed testdata/*.json
var testdata embed.FS
var Testdata = struct {
Resources resourceTestdata
}{
Resources: resourceTestdata{
File: fromTestData[search.Resource]("resource_file.json"),
},
}
type resourceTestdata struct {
File search.Resource
}
func fromTestData[D any](name string) D {
name = path.Join("./testdata", name)
data, err := testdata.ReadFile(name)
if err != nil {
panic(fmt.Sprintf("failed to read testdata file %s: %v", name, err))
}
var d D
if json.Unmarshal(data, &d) != nil {
panic(fmt.Sprintf("failed to unmarshal testdata %s: %v", name, err))
}
return d
}