Monday, November 08, 2010 at 12:04 AM.

on restartIndex (siteName, flMessages=false) {
	<<Delete all pages from the index that are in the specified site.
		<<Returns the number of pages deleted.
	local (indexPath = ()); ();
	local (adrIndex = @[indexPath].index);
	local (adrPageInfoTable = @[indexPath].pageInfo);
	local (i, lowerSiteName = string.lower (siteName));
	local (ctDeletes = 0);
	<<Loop through all indexed pages, looking for pages in this site.
	for i = sizeOf (adrPageInfoTable^) downTo 1 {
		local (adrPageInfo = @adrPageInfoTable^ [i]);
		local (url = nameOf (adrPageInfo^));
		if flMessages {
			msg ("Search Engine: checking " + url)};
		if defined (adrPageInfo^.siteName) {
			local (lowerPageSite = string.lower (adrPageInfo^.siteName));
			<<Is this page in the site?
			if lowerPageSite == lowerSiteName {
				<<Delete this page from the index.
				if flMessages {
					msg ("Search Engine: de-indexing " + url + "...")}; (url);
		sys.systemTask ()};
	if flMessages {
		msg ("Search Engine: Saving Index.root...")}; (indexPath);
	msg ("");
	return (ctDeletes)}

This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.