Created
March 7, 2014 12:07
-
-
Save rofr/9410314 to your computer and use it in GitHub Desktop.
More code from geekstream.devrexlabs.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void RemoveFeedFromSearchIndex(Feed feed) | |
{ | |
var searchTermsToRemove = new List<string>(); | |
var itemsToRemove = new HashSet<FeedItem>(feed.Items); | |
foreach (KeyValuePair<string, HashSet<IndexEntry>> kvp in _searchIndex) | |
{ | |
var searchTerm = kvp.Key; | |
var entrySet = kvp.Value; | |
_statistics.TotalKeywords -= entrySet.RemoveWhere(entry => itemsToRemove.Contains(entry.Item)); | |
if (entrySet.Count == 0) searchTermsToRemove.Add(searchTerm); | |
} | |
_statistics.UniqueKeywords -= searchTermsToRemove.Count; | |
foreach (string searchTerm in searchTermsToRemove) _searchIndex.Remove(searchTerm); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment