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

on indexDiscussionMessage (adrStorage, flSpawnThread=true) {
	<<Add a discussion group message to the search engine.
	<<Get the address of the message reader page.
	local (adrMessages = parentOf (adrStorage^));
	local (adrRoot = parentOf (adrMessages^));
	local (adrPrefs = @adrRoot^.prefs);
	local (adrMsgReader);
	local (rootName = nameOf (adrRoot^));
	local (lowerRootName = string.lower (rootName));
	if not defined (adrPrefs^.adrMsgReader) { (adrStorage, "the address of the msgReader page isn't specified in the prefs for this discussion group.");
		return (true)};
	adrMsgReader = adrPrefs^.adrMsgReader;
	if not defined (adrMsgReader) { (adrStorage, "adrMsgReader, in the prefs for this discussion group, points to a page that doesn't exist.");
		return (true)};
	<<Index the msgReader-type page. (adrMsgReader, true, adrStorage);
	<<Handle alsoListedIn.
	if defined (adrStorage^.alsoListedIn) {
		local (i);
		<<Loop through each alsoListedIn category, and find and index each page.
		for i = 1 to sizeOf (adrStorage^.alsoListedIn) {
			local (site = adrStorage^.alsoListedIn [i]);
			local (adrStory);
			if not defined ([site]) { (adrStorage, "the alsoListedIn site " + site + " has no table in");
			local (adrSiteTable =[site]);
			if not defined (adrSiteTable^.adrStories) { (adrStorage, "the site table for site " + site + " has no adrStories element.");
			local (adrStoriesTable = adrSiteTable^.adrStories);
			if not defined (adrStoriesTable^) { (adrStorage, adrStoriesTable + ", referenced from the table for site " + site + ", is not defined.");
			local (flFound = false);
			on checkTable (adrTable) {
				local (j);
				for j = 1 to sizeOf (adrTable^) {
					if flFound {
					local (adrItem = @adrTable^ [j]);
					if html.traversalSkip (adrItem) {
					if defined (adrItem^.msgNum) and defined (adrItem^.discussionRoot) {
						if string.popLeading (adrItem^.msgNum, '0') == string.popLeading (nameOf (adrStorage^), '0') {
							if string.lower (adrItem^.discussionRoot) == lowerRootName {
								adrStory = adrItem;
								flFound = true;
					if typeOf (adrItem^) == tableType {
						checkTable (adrItem);
			checkTable (adrStoriesTable);
			if not flFound { (adrStorage, "the indexer couldn't find the story with a msgNum of " + nameOf (adrStorage^))}
			else { //the page has been found, index it (adrStory, adrSiteTable:adrSiteTable)}}};
	return (true)}

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.