public void SetIndexId(string url, int index) { CachedFile cf = (CachedFile)_Index[url.ToLower()]; if (cf != null) { cf.IndexId = index; } }
public string[] GetDocumentCache(string url) { CachedFile cf = (CachedFile)_Index[url.ToLower()]; if (cf != null) { return(cf.Words); } return(null); }
private System.Collections.Hashtable _Index = new System.Collections.Hashtable(); //TODO: implement collection with faster searching public bool Add(string[] words, File infile) { // ### Make sure the Word object is in the index ONCE only if (_Index.ContainsKey(infile.Url.UnicodeToCharacter())) { // already cached return(false); } else { CachedFile cf = new CachedFile(); cf.Url = infile.Url.UnicodeToCharacter(); for (int i = 0; i < words.Length; i++) { words[i] = words[i].UnicodeToCharacter(); } cf.Words = words; _Index.Add(infile.Url, cf); } return(true); }
public bool Add(string[] words, File infile) { // ### Make sure the Word object is in the index ONCE only if (_Index.ContainsKey(infile.Url.UnicodeToCharacter())) { // already cached return false; } else { CachedFile cf = new CachedFile(); cf.Url = infile.Url.UnicodeToCharacter(); for(int i = 0; i < words.Length; i++) { words[i] = words[i].UnicodeToCharacter(); } cf.Words = words; _Index.Add(infile.Url, cf); } return true; }