public async Task GlobalSetup() { _path = Guid.NewGuid().ToString(); var plain = await PlainIndex(); _lmdb = new LmdbIndex(_path); foreach (var field in plain.Fields) { _lmdb.AddField(field); } foreach (var(k, v) in plain.FieldVectors) { _lmdb.AddFieldVector(k, v); } foreach (var(k, v) in plain.InvertedIndex) { _lmdb.AddInvertedIndexEntry(k, v); } Index = new DelegatedIndex(_lmdb, plain.Pipeline); }
private DelegatedIndex CopyIndex(Lunr.Index index) { var path = _tempDir.NewDirectory(); var lmdb = new LmdbIndex(path); foreach (var field in index.Fields) { Assert.True(lmdb.AddField(field)); } foreach (var(k, v) in index.FieldVectors) { Assert.True(lmdb.AddFieldVector(k, v)); } foreach (var(k, v) in index.InvertedIndex) { Assert.True(lmdb.AddInvertedIndexEntry(k, v)); } var idx = new DelegatedIndex(lmdb, index.Pipeline); return(idx); }