public async Task AddTermsWithMultipleCommits_AllShouldBeFound() { _fix = new FieldIndex(RootIndexDir, "text"); await _fix.AddTerm("term of document 1", 1); await _fix.AddTerm("another term of document 1", 1); await _fix.Commit(); await _fix.AddTerm("term of document 2", 2); await _fix.AddTerm("another term of document 2", 2); await _fix.Commit(); _fix.Search("term of document 1") .Should().BeEquivalentTo(new[] { 1 }); _fix.Search("another term of document 1") .Should().BeEquivalentTo(new[] { 1 }); _fix.Search("term of document 2") .Should().BeEquivalentTo(new[] { 2 }); _fix.Search("another term of document 2") .Should().BeEquivalentTo(new[] { 2 }); }
public async Task QueryNonExistingTerm_ShouldGetEmptyResultSet() { _fix = new FieldIndex(RootIndexDir, "text"); await _fix.AddTerm("term of document 1", 1); await _fix.Commit(); _fix.Search("unknown term").Should().BeEmpty(); }
public async Task AddedTermCanBeFoundByItsValue() { _fix = new FieldIndex(RootIndexDir, "text"); await _fix.AddTerm("term of document 1", 1); await _fix.AddTerm("another term of document 1", 1); await _fix.AddTerm("term of document 2", 2); await _fix.AddTerm("another term of document 2", 2); await _fix.Commit(); _fix.Search("term of document 1") .Should().BeEquivalentTo(new[] { 1 }); _fix.Search("another term of document 1") .Should().BeEquivalentTo(new[] { 1 }); _fix.Search("term of document 2") .Should().BeEquivalentTo(new[] { 2 }); _fix.Search("another term of document 2") .Should().BeEquivalentTo(new[] { 2 }); }