Monday, November 08, 2010 at 12:04 AM.
system.verbs.builtins.mainResponder.search.server.logBrowserIndexer
on logBrowserIndexer (linecount, colors) { //a macro that returns HTML for the log
local (adrlog = log.getGuestSubTable ("Search Engine Indexer"));
linecount = number (linecount); //I keep getting bit by this, when called thru a macro, it's a string DW
local (htmltext = "", indentlevel = 0);
on add (s) {
htmltext = htmltext + string.filledString ("\t", indentlevel) + s + "\r"};
on td (s) {
return ("<td><font size=\"-1\">" + s + "</font></td>")};
local (i, j, adrhourtable, adritem, sizelog = sizeof (adrlog^), ixlog, sizehourtable);
add ("<table width=\"92%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"); indentlevel++;
<<Add headers.
add ("<tr>");
indentlevel++;
add ("<td height=\"28\"></td>"); //a dummy table cell to establish row height
add (td ("<b>Time</b>"));
add (td ("<b>URL</b>"));
add (td ("<b>Site</b>"));
add (td ("<b>Client</b>"));
add (td ("<b>Index Name</b>"));
add ("</tr>");
indentlevel--;
adrhourtable = @adrlog^ [sizelog]; //generate for the most recent hour
sizehourtable = sizeof (adrhourtable^);
ixlog = sizehourtable - linecount + 1;
if ixlog < 1 {
ixlog = 1};
for j = sizehourtable downto ixlog {
adritem = @adrhourtable^ [j];
add ("<!-- " + j + " -->");
local (ixhtmltext = sizeof (htmltext));
add ("<tr bgcolor=\"" + colors [(j % sizeof (colors)) + 1] + "\">"); indentlevel++;
add ("<td height=\"28\"></td>"); //a dummy table cell to establish row height
add (td (xml.convertToDisplayName (nameOf (adrItem^))));
bundle { //add the title
local (title = adrItem^.title);
title = searchEngine.stripMarkup (title);
title = string.trimWhiteSpace (title);
if sizeOf (title) > 25 {
title = string.mid (title, 1, 25) + "..."};
local (url = adrItem^.url);
url = string.nthField (url, '@', 1);
add (td (html.getLink (title, url)))};
add (td (html.getLink (adrItem^.siteName, adrItem^.siteUrl)));
bundle { //add the member name, if we have it, otherwise do a DNS lookup
local (client = adrItem^.client);
try {client = tcp.dns.getDomainName (adrItem^.client)};
add (td (client))};
add (td (adrItem^.indexName));
add ("</tr>"); indentlevel--};
add ("</table>"); indentlevel--;
return (htmltext)}
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.