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


on searchMacro (sites, adrPrefs=@user.searchEngine.prefs) {
	<<Call this macro from a .wsf or other dynamic page.
		<<This a wrapper for searchEngine.doSearch.
			<<sites is a list of site names.
			<<adrPrefs is the address of the prefs table to use.
				<<Default is user.searchEngine.prefs,
				<<but you can have multiple prefs tables
				<<if you're running multiple search engines
				<<with different prefs.
	local (adrPageTable = html.getPageTableAddress ());
	local (args, url);
	url = adrPageTable^.url;
	<<Get the search args.
	try {
		args = adrPageTable^.searchArgs}
	else {
		args = ""};
	return (searchEngine.doSearch (sites, url, adrPageTable^.adrObject, args, adrPrefs))}

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.