private void AddEntry(string word, int occurenceCount, Document document) { if (!index.ContainsKey(word)) { index[word] = new PostingsList(); } index[word].AddDocument(document.ID, occurenceCount); }
public void NewDocument(Uri uri, string content) { Document doc = new Document(nextID, uri, content); documentsByURI.Add(uri, doc); documentsByID.Add(nextID, doc); nextID++; foreach (IGrouping<string, string> word in doc.Words.GroupBy(w => w)) { AddEntry(word.Key, word.Count(), doc); } }