Пример #1
0
        public void SetIndexId(string url, int index)
        {
            CachedFile cf = (CachedFile)_Index[url.ToLower()];

            if (cf != null)
            {
                cf.IndexId = index;
            }
        }
Пример #2
0
        public string[] GetDocumentCache(string url)
        {
            CachedFile cf = (CachedFile)_Index[url.ToLower()];

            if (cf != null)
            {
                return(cf.Words);
            }
            return(null);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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;
        }