/**************************************************************************/ private void ProcessText(MacroscopeDocument msDoc) { List <string> TextBlocks = new List <string> (16); List <string> Terms = new List <string> (256); bool CaseSensitive = MacroscopePreferencesManager.GetCaseSensitiveTextIndexing(); TextBlocks.Add(msDoc.GetTitle()); TextBlocks.Add(msDoc.GetDescription()); TextBlocks.Add(msDoc.GetKeywords()); TextBlocks.Add(msDoc.GetDocumentTextCleaned()); DebugMsg(string.Format("ProcessText: TextBlocks.Count: {0}", TextBlocks.Count)); if (TextBlocks.Count > 0) { for (int i = 0; i < TextBlocks.Count; i++) { string [] Chunk = TextBlocks[i].Split(' '); if (Chunk.Length > 0) { for (int j = 0; j < Chunk.Length; j++) { if (Chunk[j].Length > 0) { if (!Terms.Contains(Chunk[j])) { Terms.Add(Chunk[j]); } } } } } } DebugMsg(string.Format("ProcessText: Words :: {0}", Terms.Count)); for (int i = 0; i < Terms.Count; i++) { Dictionary <string, MacroscopeDocument> DocumentReference; string Term = Terms[i]; if (!CaseSensitive) { Term = Term.ToLower(); } DebugMsg(string.Format("ProcessText: Term :: {0}", Term)); if (InvertedIndex.ContainsKey(Term)) { DocumentReference = this.InvertedIndex[Term]; } else { DocumentReference = new Dictionary <string, MacroscopeDocument> (); this.InvertedIndex.Add(Term, DocumentReference); } if (!DocumentReference.ContainsKey(msDoc.GetUrl())) { DocumentReference.Add(msDoc.GetUrl(), msDoc); } } }