public void GetDocsWithTerm() { uint docID1 = 1, docID2 = 2, docID3 = 3; string fieldName = "content"; string term1 = "c#", term2 = "java"; var index = new Munq.Search.Index.FieldIndex(); index.AddDocFieldTermCount(fieldName, term1, docID1, 5); index.AddDocFieldTermCount(fieldName, term1, docID2, 3); index.AddDocFieldTermCount(fieldName, term2, docID3, 2); var docsWithTerm1 = index.GetDocsWithTermInField(term1, fieldName); Verify.That(docsWithTerm1).IsACollectionThat().Count().IsEqualTo(2); Verify.That(docsWithTerm1[docID1]).IsEqualTo(5U); Verify.That(docsWithTerm1[docID2]).IsEqualTo(3U); var docsWithTerm2 = index.GetDocsWithTermInField(term2, fieldName); Verify.That(docsWithTerm2).IsACollectionThat().Count().IsEqualTo(1); Verify.That(docsWithTerm2[docID3]).IsEqualTo(2U); }
public void GetDocsWithTerm() { uint docID1 = 1, docID2 = 2, docID3 = 3; string fieldName = "content"; string term1 = "c#", term2 = "java"; var index = new Munq.Search.Index.FieldIndex(); index.AddDocFieldTermCount(fieldName, term1, docID1, 5); index.AddDocFieldTermCount(fieldName, term1, docID2, 3); index.AddDocFieldTermCount(fieldName, term2, docID3, 2); var docsWithTerm1 = index.GetDocsWithTermInField(term1, fieldName); Verify.That(docsWithTerm1).IsACollectionThat().Count().IsEqualTo(2); Verify.That(docsWithTerm1[docID1]).IsEqualTo(5U); Verify.That(docsWithTerm1[docID2]).IsEqualTo(3U); var docsWithTerm2 = index.GetDocsWithTermInField(term2, fieldName); Verify.That(docsWithTerm2).IsACollectionThat().Count().IsEqualTo(1); Verify.That(docsWithTerm2[docID3]).IsEqualTo(2U); }