|
From: <cre...@us...> - 2007-09-08 20:14:53
|
Revision: 1732
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1732&view=rev
Author: creecode
Date: 2007-09-08 13:14:53 -0700 (Sat, 08 Sep 2007)
Log Message:
-----------
if buildObject isn't used to build the pageText then we run it through html.processMacros
messageReader can now be a script
Modified Paths:
--------------
ODBs/trunk/mainResponderRoot/mainResponder/search/client/indexPage.fvc
Modified: ODBs/trunk/mainResponderRoot/mainResponder/search/client/indexPage.fvc
===================================================================
--- ODBs/trunk/mainResponderRoot/mainResponder/search/client/indexPage.fvc 2007-09-08 20:02:59 UTC (rev 1731)
+++ ODBs/trunk/mainResponderRoot/mainResponder/search/client/indexPage.fvc 2007-09-08 20:14:53 UTC (rev 1732)
@@ -1,25 +1,33 @@
-FrontierVcsFile:1:scpt:mainResponder.search.client.indexPage
+FrontierVcsFile:3:scpt:mainResponder.search.client.indexPage
on indexPage (adrObject, adrPageTable, flMsgReader=false, adrDgMsg=nil, adrSiteTable=nil) {
- \xC7This script is called from the high-level mainResponder.search.client.index verb. It should not be called from anywhere else.
- \xC7This script indexes a web page in a website table.
- \xC7Changes:
- \xC710/15/99; 12:29:17 PM by PBS
- \xC7Get the proper created and modified dates for dg messages.
- local (objType = typeOf (adrObject^));
- local (pageText, title, url);
- local (searchTable);
- local (flDatabaseSupportsIndexing);
+ «Changes
+ «5/10/07; 6:11:25 PM by TAC
+ «if buildObject isn't used to build the pageText then we run it through html.processMacros
+ «messageReader can now be a script
+ «10/15/99; 12:29:17 PM by PBS
+ «Get the proper created and modified dates for dg messages.
+ «??/??/?? by ???
+ «Created. This script indexes a web page in a website table.
+ «This script is called from the high-level mainResponder.search.client.index verb. It should not be called from anywhere else.
+ local ( flDatabaseSupportsIndexing, pageText, searchTable, title, url );
+ local ( flProcessMacros = true );
+ local ( objType = typeOf ( adrObject^ ) );
+
new (tableType, @searchTable);
- on getRenderedPageText (adrPage) { //this is called when it's necessary to use html.buildObject to get the page text
- table.emptyTable (adrPageTable);
- html.buildObject (adrPage, adrPageTable); //build the page
- return (true)};
+ on getRenderedPageText ( adrPage ) { // this is called when it's necessary to use html.buildObject to get the page text
+ table.emptyTable ( adrPageTable );
+
+ html.buildObject ( adrPage, adrPageTable ); // build the page
+
+ flProcessMacros = false;
+
+ return ( true )};
- \xC7Once this script is called, there's no question that adrObject points to a valid web page. However, the search engine only knows how to index outlines, wp-text, tables, and scripts. Anything else is not indexed. So first check the type of adrObject to be sure it's valid.
+ «Once this script is called, there's no question that adrObject points to a valid web page. However, the search engine only knows how to index outlines, wp-text, tables, and scripts. Anything else is not indexed. So first check the type of adrObject to be sure it's valid.
bundle { //check the type
local (flValidType = false);
case objType {
@@ -55,7 +63,7 @@
searchTable.server = searchTable.domain;
searchTable.procedure = searchTable.addToIndex};
- \xC7Call the script in the #search table that gets the title and page text.
+ «Call the script in the #search table that gets the title and page text.
bundle {
local (adrScript);
if defined (searchTable.getContent) {
@@ -65,10 +73,10 @@
try {adrScript^ (@searchTable)}}};
if searchTable.title == nil or searchTable.bodyText == nil {
- \xC7wp-text and outline objects are indexed one way, scripts another, and tables yet another way.
+ «wp-text and outline objects are indexed one way, scripts another, and tables yet another way.
if (objType == wpTextType) or (objType == outlineType) {
if not flMsgReader {
- \xC7These types are coerced to a string.
+ «These types are coerced to a string.
pageText = string (adrObject^);
if searchTable.title == nil {
searchTable.title = html.getOneDirective ("title", pageText)}}
@@ -78,28 +86,60 @@
pageText = string (adrDgMsg^.body)}};
if objType == tableType {
- \xC7If there's a msgNum, find the discussion root and get the text of the message.
- \xC7Otherwise, use html.buildObject to get the text of the page that way.
+ «If there's a msgNum, find the discussion root and get the text of the message.
+ «Otherwise, use html.buildObject to get the text of the page that way.
if defined (adrObject^.msgNum) and defined (adrObject^.discussionRoot) { //there's a discussion group message to get
local (adrMsg = mainResponder.news.getMessageTable (adrObject^.discussionRoot, adrObject^.msgNum));
if searchTable.title == nil {
searchTable.title = adrMsg^.subject};
pageText = string (adrMsg^.body)}
else {
- \xC7Use html.buildObject to get the text of the page.
+ «Use html.buildObject to get the text of the page.
pageText = getRenderedPageText (adrObject)}};
if objType == scriptType {
- \xC7Use html.buildObject to get the text of the page.
- getRenderedPageText (adrObject);
- pageText = adrPageTable^.renderedText};
+ if flMsgReader {
+ pageText = string ( adrDgMsg^.body );
+
+ searchTable.title = adrDgMsg^.subject}
+ else {
+ getRenderedPageText ( adrObject ); // use html.buildObject to get the text of the page
+
+ pageText = adrPageTable^.renderedText}};
+ if flProcessMacros {
+ local ( oldPta, pt );
+
+ new ( tableType, @pt );
+
+ try {
+ oldPta = html.getPageTableAddress ( )};
+
+ if oldPta == nil {
+ pt.adrObject = nil;
+ pt.adrSiteRootTable = adrPageTable^.adrSiteRootTable;
+ pt.glossary = @pt.adrSiteRootTable^.[ "#glossary" ]}
+ else {
+ pt.adrObject = oldPta^.adrObject;
+ pt.adrSiteRootTable = oldPta^.adrSiteRootTable;
+ pt.glossary = oldPta^.glossary};
+
+ html.setPageTableAddress ( @pt );
+
+ pageText = html.processMacros ( pageText, adrPageTable: @pt );
+
+ if oldPta == nil {
+ html.deletePageTableAddress ( )}
+ else {
+ html.setPageTableAddress ( oldPta )}};
+
if searchTable.bodyText == nil {
searchTable.bodyText = pageText};
+
if searchTable.title == nil {
searchTable.title = adrPageTable^.title}};
- \xC7It's possible that there's no bodyText or title, even at this point. (Particularly if the page is an address, and the getContent callback didn't fill in those values.) If so, don't index the page, log the failure.
+ «It's possible that there's no bodyText or title, even at this point. (Particularly if the page is an address, and the getContent callback didn't fill in those values.) If so, don't index the page, log the failure.
if searchTable.bodyText == nil {
mainResponder.search.client.logNoIndex (adrObject, "the body text of the page can't be retrieved.");
return (true)};
@@ -111,7 +151,7 @@
local (msgNum = number (nameOf (adrDgMsg^)));
searchTable.url = searchTable.url + "$" + msgNum;
- \xC7PBS 10/15/99: get the proper created and mod dates for this dg message.
+ «PBS 10/15/99: get the proper created and mod dates for this dg message.
searchTable.createdDate = adrDgMsg^.postTime;
if defined (adrDgMsg^.lastUpdate) {
searchTable.lastModDate = adrDgMsg^.lastUpdate}
@@ -120,7 +160,9 @@
mainResponder.search.client.sendPageToServer (@searchTable);
- \xC7Log the fact that we sent this to the server.
+ «Log the fact that we sent this to the server.
mainResponder.search.client.log ("Sent " + adrObject + " to the server for indexing.", adrObject);
- return (true)}
\ No newline at end of file
+ return (true)}
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|