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

system.verbs.apps.AnArchie.examples.outlineResults

on outlineResults (searchResults, sortList=nil, outlineAddr=nil) {
	local (x, count, dir = right);
	
	bundle { <<set up the outline
		if (outlineAddr == nil) {
			outlineAddr = @scratchpad.searchResults};
		if not defined (outlineAddr^) {
			new (outlineType, outlineAddr);
			target.set (outlineAddr);
			editMenu.setFont ("Monaco");
			editMenu.setFontSize (9);
			target.clear ()};
		edit (outlineAddr); <<user can see what's going on
		target.set (outlineAddr); <<user can bring a different window to front
		op.fullCollapse ();
		op.firstSummit ();
		if op.getLineText () == "" {
			op.setLineText ("Search Results " + clock.now())}
		else {
			op.insert ("Search Results " + clock.now(), up)}};
	
	dir = right;
	count = sizeof(searchResults^);
	for x = 1 to count {
		aRec = searchResults^[x];
		if (aRec[anarchie.eventInfo.isDirectory]) {
			op.insert(aRec[1] + " Ä", dir)}
		else {
			op.insert(aRec[1], dir)};
		dir = down; << after the first, insert down
		<<op.insert (searchResults^[x]['name'], dir)
		
		<<do all the subfields of the record
		with anarchie, eventInfo {
			op.insert("Host: "+aRec[host], right);
			op.insert("Path: "+aRec[path], down);
			op.insert("Size: "+aRec[fileSize], down);
			op.insert("Date: "+string(aRec[modification]), down)};
		
		op.go(left,1);
		op.collapse ()};
	
	bundle { <<restore the outline
		op.firstSummit ();
		if (sortList) {
			op.go(right, 1);
			op.sort()};
		target.clear()}}; << just in case!

<<outlineResults(@people.x)



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.