From ef8e8704c59b914a314220271eb76c29b68ac04d Mon Sep 17 00:00:00 2001 From: JT Smith Date: Sun, 29 Feb 2004 04:05:12 +0000 Subject: [PATCH] adding search engine --- docs/changelog/6.x.x.txt | 4 +- docs/upgrades/upgrade_5.9.9-6.0.0.pl | 1 + docs/upgrades/upgrade_5.9.9-6.0.0.sql | 127 ++++++++++++++++++++++++++ etc/WebGUI.conf.original | 2 +- lib/WebGUI/Wobject.pm | 12 +++ lib/WebGUI/Wobject/DataForm.pm | 58 ++++++++++++ lib/WebGUI/Wobject/EventsCalendar.pm | 35 +++++++ lib/WebGUI/Wobject/FileManager.pm | 38 ++++++++ lib/WebGUI/Wobject/MessageBoard.pm | 65 +++++++++++++ lib/WebGUI/Wobject/Poll.pm | 38 ++++++++ lib/WebGUI/Wobject/Product.pm | 48 ++++++++++ lib/WebGUI/Wobject/Survey.pm | 37 ++++++++ lib/WebGUI/Wobject/USS.pm | 71 ++++++++++++++ sbin/runHourly.pl | 2 +- 14 files changed, 535 insertions(+), 3 deletions(-) diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index fc65a063e..5889ef294 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -84,5 +84,7 @@ webgui. - Migrated the navigation items (Thanks to Leendert Bottelberghs, Len Kranendonk). - Removed all old navigation macros. See gotcha's for details. - + - Added a variation on Len's Advanced Search wobject. Thanks to Len + Kranendonk for creating the original version for the WebGUI community + contest. diff --git a/docs/upgrades/upgrade_5.9.9-6.0.0.pl b/docs/upgrades/upgrade_5.9.9-6.0.0.pl index 440856e92..5358a5fe0 100644 --- a/docs/upgrades/upgrade_5.9.9-6.0.0.pl +++ b/docs/upgrades/upgrade_5.9.9-6.0.0.pl @@ -522,6 +522,7 @@ foreach my $wobject (@{$wobjects}) { push(@newWobjects,$wobject); } } +push(@newWobjects,"IndexedSearch"); push(@newWobjects,"WSClient"); $conf->set("wobjects"=>\@newWobjects); $conf->set("emailRecoveryLoggingEnabled"=>1); diff --git a/docs/upgrades/upgrade_5.9.9-6.0.0.sql b/docs/upgrades/upgrade_5.9.9-6.0.0.sql index a25d26ef4..bf1f9fbcb 100644 --- a/docs/upgrades/upgrade_5.9.9-6.0.0.sql +++ b/docs/upgrades/upgrade_5.9.9-6.0.0.sql @@ -535,3 +535,130 @@ update language set toolbar='metal' where toolbar='default'; INSERT INTO userProfileField VALUES ('toolbar','WebGUI::International::get(746)',0,0,'selectList','WebGUI::Icon::getToolbarOptions()','[\'useLanguageDefault\']',13,4,0,0); INSERT INTO template VALUES (7,'Cool Menus','\r\n\r\n\r\n\r\n\r\n\r\n \r\n\r\n\r\n\r\n\r\n','Navigation'); +CREATE TABLE IndexedSearch_docInfo ( + docId int(11) NOT NULL default '0', + indexName varchar(35) not NULL default 'Search_index', + pageId int(11) NOT NULL default '0', + wobjectId int(11) NOT NULL default '0', + page_groupIdView int(11) default NULL, + wobject_groupIdView int(11) default NULL, + wobject_special_groupIdView int(11) default NULL, + languageId int(11) NOT NULL default '0', + namespace varchar(35) default NULL, + location varchar(255) default NULL, + headerShortcut text default NULL, + bodyShortcut text default NULL, + contentType text NOT NULL, + ownerId int(11) default '1', + PRIMARY KEY (docId, indexName) +) TYPE=MyISAM; + +CREATE TABLE IndexedSearch ( + wobjectId int(11) NOT NULL default '0', + indexName varchar(35) default 'Search_index', + users text, + searchRoot text, + pageList text, + namespaces text, + paginateAfter int(11) default NULL, + languages text, + contentTypes text, + previewLength int(11), + highlight int(11), + highlight_1 varchar(35), + highlight_2 varchar(35), + highlight_3 varchar(35), + highlight_4 varchar(35), + highlight_5 varchar(35), + PRIMARY KEY (wobjectId) +) TYPE=MyISAM; + + +INSERT INTO help VALUES (1,'IndexedSearch',26,27,'21,WebGUI;2,IndexedSearch'); +INSERT INTO help VALUES (2,'IndexedSearch',29,28,'21,WebGUI;1,IndexedSearch;'); + +INSERT INTO international VALUES (27,'IndexedSearch',1,'\r\n

The Search adds advanced search capabilities to your WebGUI site.

\r\n

Index to use
The Search uses an index to retrieve it\'s \r\nresults from. Indexes are created with the scheduler. You can create more then one index. Choose here which index to use.

\r\n

Search through
By default all pages are searched. You can \r\nlimit the search to certain page roots. Multiple choices are allowed.

\r\n

Only results created by
You can limit the results to \r\nitems created by certain users. By default items from any user are returned.

\r\n

Only results in namespace
By default all namespaces are \r\nsearched. You can limit the search to certain namespaces. An example of usage is \r\nto search only in products.

\r\n

Only results in language
If you have a multi-lingual \r\nsite, you can use this option to limit the search results to a certain \r\nlanguage.

\r\n

Only results of type
You can limit the search to certain \r\ntypes of content.

\r\n
\r\n

Discussion: Messages on the forums, discussions on \r\narticles or USS.
Help: Content in the online WebGUI help \r\nsystem
Page: Page title and \r\nsynopsis
Profile: User Profiles
Wobject: Wobject Title \r\nand Description
Wobject details: All other wobject data. For example \r\nFAQ question, Calendar item, etc.

\r\n

Template
Select a template to layout \r\nyour Search. The different templates have different functionality.

\r\n

Paginate after
The number of results \r\nyou\'d like to display on a page.

\r\n

Context preview length
The maximum \r\nnumber of characters in each of the context sections. Default is 130 characters. \r\nA negative length gives the complete body, while a preview length of null gives \r\nno preview.

\r\n

Highlight results ?
If you want to \r\nhighlight the search results in the preview you\'ll want to check this box.

\r\n

Highlight color n
The colors that are \r\nused to highlight the corresponding words in the query. 

',1070195783,''); +INSERT INTO international VALUES (4,'IndexedSearch',2,'Diese Seite',1066925977,NULL); +INSERT INTO international VALUES (25,'IndexedSearch',2,'Beliebiger Benutzer',1066944998,NULL); +INSERT INTO international VALUES (24,'IndexedSearch',2,'Beliebige Sprache',1066944983,NULL); +INSERT INTO international VALUES (26,'IndexedSearch',1,'Search, Add/Edit',1067346336,''); +INSERT INTO international VALUES (23,'IndexedSearch',2,'Jeder Inhaltstyp',1066926216,NULL); +INSERT INTO international VALUES (12,'IndexedSearch',2,'Vorschauläe des Suchergebnisses',1066926202,NULL); +INSERT INTO international VALUES (8,'IndexedSearch',2,'Nur Ergebnisse aus den Bereichen',1066926233,NULL); +INSERT INTO international VALUES (18,'IndexedSearch',2,'Beliebige Bereiche',1066926181,NULL); +INSERT INTO international VALUES (19,'IndexedSearch',2,'Wobject',1066926116,NULL); +INSERT INTO international VALUES (20,'IndexedSearch',2,'Wobject Details',1066926104,NULL); +INSERT INTO international VALUES (21,'IndexedSearch',2,'Standardinhalte',1066950450,NULL); +INSERT INTO international VALUES (22,'IndexedSearch',2,'Profil',1066926050,NULL); +INSERT INTO international VALUES (3,'IndexedSearch',2,'Fütere Informationen schauen Sie sich bitte die Dokumentation an.',1066926030,NULL); +INSERT INTO international VALUES (5,'IndexedSearch',2,'verwendeter Index',1066925936,NULL); +INSERT INTO international VALUES (6,'IndexedSearch',2,'Durchsuchen von',1066925874,NULL); +INSERT INTO international VALUES (9,'IndexedSearch',2,'Nur Ergebnisse in der Sprache',1066925743,NULL); +INSERT INTO international VALUES (7,'IndexedSearch',2,'Nur Ergebnisse erstellt von',1066925809,NULL); +INSERT INTO international VALUES (15,'IndexedSearch',2,'Alle Seiten',1066925603,NULL); +INSERT INTO international VALUES (16,'IndexedSearch',2,'Suche starten!',1066925622,NULL); +INSERT INTO international VALUES (17,'IndexedSearch',2,'Suchen',1066925643,NULL); +INSERT INTO international VALUES (2,'IndexedSearch',2,'Es wurde kein Index erstellt! Starten Sie zuerst das Script \"buildindex.pl\".',1066925703,NULL); +INSERT INTO international VALUES (14,'IndexedSearch',2,'Hervorhebungsfarbe',1066925591,NULL); +INSERT INTO international VALUES (13,'IndexedSearch',2,'Ergebnisse farbig hervorheben?',1066925550,NULL); +INSERT INTO international VALUES (11,'IndexedSearch',2,'Seitenumbruch nach',1066925284,NULL); +INSERT INTO international VALUES (10,'IndexedSearch',2,'Nur Ergebnisse vom Typ',1066925261,NULL); +INSERT INTO international VALUES (1,'IndexedSearch',2,'Die Tabelle Search_docInfo kann nicht geöet werden.',1066925177,NULL); +INSERT INTO international VALUES (25,'IndexedSearch',1,'Any user',1066766053,''); +INSERT INTO international VALUES (24,'IndexedSearch',1,'Any language',1066766053,''); +INSERT INTO international VALUES (23,'IndexedSearch',1,'Any Content Type',1066766053,'Any type of content'); +INSERT INTO international VALUES (21,'IndexedSearch',1,'Content',1066765681,'Collective term for Wobjects, Pages and Wobject details.'); +INSERT INTO international VALUES (22,'IndexedSearch',1,'Profile',1066765844,''); +INSERT INTO international VALUES (19,'IndexedSearch',1,'Wobject',1066765495,''); +INSERT INTO international VALUES (20,'IndexedSearch',1,'Wobject details',1066765556,''); +INSERT INTO international VALUES (18,'IndexedSearch',1,'Any namespace',1066593420,'first option for \"Search in namespace:\"'); +INSERT INTO international VALUES (17,'IndexedSearch',1,'Search',1066593262,'Title of this wobject'); +INSERT INTO international VALUES (16,'IndexedSearch',1,'Search',1066565087,'Label of the search submit button.'); +INSERT INTO international VALUES (15,'IndexedSearch',1,'All pages',1066253116,''); +INSERT INTO international VALUES (14,'IndexedSearch',1,'Highlight color',1066252536,''); +INSERT INTO international VALUES (13,'IndexedSearch',1,'Highlight results ?',1066252498,''); +INSERT INTO international VALUES (12,'IndexedSearch',1,'Context preview length',1066252463,''); +INSERT INTO international VALUES (11,'IndexedSearch',1,'Paginate after',1066252409,''); +INSERT INTO international VALUES (10,'IndexedSearch',1,'Only results of type',1066252387,''); +INSERT INTO international VALUES (9,'IndexedSearch',1,'Only results in language',1066252363,''); +INSERT INTO international VALUES (8,'IndexedSearch',1,'Only results in namespace',1066252344,''); +INSERT INTO international VALUES (7,'IndexedSearch',1,'Only results created by',1066252303,''); +INSERT INTO international VALUES (2,'IndexedSearch',1,'No index created. The scheduler must run and create the index first.',1066252099,''); +INSERT INTO international VALUES (3,'IndexedSearch',1,'Please refer to the documentation for more info.',1066252166,''); +INSERT INTO international VALUES (4,'IndexedSearch',1,'This page',1066252218,''); +INSERT INTO international VALUES (5,'IndexedSearch',1,'Index to use',1066252241,''); +INSERT INTO international VALUES (6,'IndexedSearch',1,'Search through',1066252264,''); +INSERT INTO international VALUES (1,'IndexedSearch',1,'Table Search_docInfo can\'t be opened.',1066252055,''); +INSERT INTO international VALUES (1,'IndexedSearch',3,'De database tabel Search_docInfo kan niet geopend worden.',1068829661,NULL); +INSERT INTO international VALUES (10,'IndexedSearch',3,'Alleen resultaten van het type',1068829693,NULL); +INSERT INTO international VALUES (11,'IndexedSearch',3,'Breek pagina af na',1068829785,NULL); +INSERT INTO international VALUES (12,'IndexedSearch',3,'Context preview lengte',1068829830,NULL); +INSERT INTO international VALUES (13,'IndexedSearch',3,'Markeer resultaten ?',1068829883,NULL); +INSERT INTO international VALUES (14,'IndexedSearch',3,'Markeer kleur',1068829896,NULL); +INSERT INTO international VALUES (15,'IndexedSearch',3,'Alle pagina\'s',1068829908,NULL); +INSERT INTO international VALUES (16,'IndexedSearch',3,'Zoek',1068829919,NULL); +INSERT INTO international VALUES (17,'IndexedSearch',3,'Zoeken',1068829940,NULL); +INSERT INTO international VALUES (18,'IndexedSearch',3,'Ieder bereik',1068829993,NULL); +INSERT INTO international VALUES (19,'IndexedSearch',3,'Wobject',1068830017,NULL); +INSERT INTO international VALUES (20,'IndexedSearch',3,'Wobject details',1068830113,NULL); +INSERT INTO international VALUES (21,'IndexedSearch',3,'Standaard inhoud',1068830147,NULL); +INSERT INTO international VALUES (22,'IndexedSearch',3,'Profielen',1068830162,NULL); +INSERT INTO international VALUES (23,'IndexedSearch',3,'Ieder content type',1068830186,NULL); +INSERT INTO international VALUES (24,'IndexedSearch',3,'Iedere taal',1068830198,NULL); +INSERT INTO international VALUES (25,'IndexedSearch',3,'Iedere user',1068830230,NULL); +INSERT INTO international VALUES (26,'IndexedSearch',3,'Zoek, Toevoegen/Bewerken',1068830292,NULL); +INSERT INTO international VALUES (3,'IndexedSearch',3,'Zie de documentatie voor meer informatie.',1068830315,NULL); +INSERT INTO international VALUES (4,'IndexedSearch',3,'Deze pagina',1068830328,NULL); +INSERT INTO international VALUES (5,'IndexedSearch',3,'Te gebruiken index',1068830341,NULL); +INSERT INTO international VALUES (6,'IndexedSearch',3,'Doorzoek',1068830353,NULL); +INSERT INTO international VALUES (7,'IndexedSearch',3,'Alleen resultaten van',1068830378,NULL); +INSERT INTO international VALUES (8,'IndexedSearch',3,'Alleen resultaten in bereik',1068830393,NULL); +INSERT INTO international VALUES (9,'IndexedSearch',3,'Alleen resultaten in taal',1068830408,NULL); +INSERT INTO international VALUES (28,'IndexedSearch',1,'\r\n

This is the list of template variables available for \r\nsearch templates:

\r\n

query
Contains the value of the query form \r\nvariable.
The allWords, atLeastOne, exactPhrase \r\nand without values are appended to this variable.

\r\n

queryHighlighted
Same as query but \r\nhighlighted.

\r\n

allWords
Contains the value of the allWords form \r\nvariable.

\r\n

atLeastOne
Contains the value of the atLeastOne \r\nform variable.

\r\n

exactPhrase
Contains the value of the \r\nexactPhrase form variable.

\r\n

without
Contains the value of the without form \r\nvariable.

\r\n

duration
The duration of the search process in seconds. \r\n

\r\n

numberOfResults
The number of results.

\r\n

startNr
The number of the first search result on the \r\npage.

\r\n

endNr
The number of the last search result on the \r\npage.

\r\n

submit
A form button with the word \"Search\" printed on \r\nit.

\r\n

wid
The wobject Id of this wobject.

\r\n

resultsLoop
A loop containing the search results. Inside \r\nthe loop the following template variables are available:

\r\n
\r\n

username
The username of the person that created this \r\nsearch result.

\r\n

ownerId
The Id of the person that created this search \r\nresult.

\r\n

userProfile
An url to the profile of the creator of this \r\nsearch result.

\r\n

header
The title of the search result. (This can be the \r\nsubject of a message, the question of a FAQ, the title of an Article, etc)

\r\n

body
A preview of the content of the search result.

\r\n

namespace
The namespace in which this search result \r\nresides.

\r\n

location
The URL of this search result.

\r\n

crumbtrail
A crumbtrail to this search result.

\r\n

contentType
The type of this search \r\nresult.

\r\n

The loops contentTypes, \r\ncontentTypesSimple, languages, \r\nnamespaces and users all look the same. \r\nThey can be used to create a select list, radio list or check list so users can \r\nrefine their search.

\r\n

This tempate variables are available inside the loops:

\r\n
\r\n

name
The (possibly internationalized) name of the \r\noption.

value
The value of the \r\noption.

selected
A conditional indicating whether \r\nthis option is selected or not.

\r\n

firstPage
A link to the first page in the paginator. \r\n

lastPage
A link to the last page in the paginator. \r\n

nextPage
A link to the next page forward in the paginator. \r\n

previousPage
A link to the next page backward in the paginator. \r\n

pageList
A list of links to all the pages in the paginator. \r\n

multiplePages
A conditional indicating whether there is more than \r\none page in the paginator. \r\n

isFirstPage
A conditional indicating whether the visitor is viewing \r\nthe first page. \r\n

isLastPage
A conditional indicating whether the visitor is viewing \r\nthe last page.

',1070202325,''); +INSERT INTO international VALUES (29,'IndexedSearch',1,'Search template',1070202588,''); + + +INSERT INTO template VALUES (2,'Advanced Search','\r\n

\r\n
\r\n\r\n\r\n

\r\n\r\n\r\n\r\n \r\n \r\n \r\n\r\n\">\r\n\r\n\r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n \r\n \r\n \r\n \r\n\r\n\r\n \r\n\r\n \r\n
Search for:\' name=\"query\">in\r\n \r\n \r\n
Content in language:\r\n \r\n \" \r\n checked=\"1\" >
\r\n
\r\n
Created by:\r\n \r\n
Type of content:\r\n \r\n Number of Results:\r\n \r\n
\r\n
\r\n\r\n

\r\n\r\n

Results - of about \r\n containing \"\". Search took seconds.

\r\n
\r\n
    \">\r\n\r\n\r\n
  1. \r\n \">\r\n No Title\r\n \r\n by \">\r\n \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
  2. \r\n
    \r\n\r\n
\r\n\n\n\n\n
\n · · \n
\n
\n','IndexedSearch'); +INSERT INTO template VALUES (3,'Search in Help','\r\n

\r\n
\r\n\r\n\r\n

\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n

\r\n
\r\n \r\n \r\n \r\n \r\n \">\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \' name=\"query\">\r\n
In namespace: \r\n \r\n
\r\n
\r\n\r\n

\r\n\r\n

Results - of about \r\n containing \"\". Search took seconds.

\r\n
\r\n
    \">\r\n\r\n\r\n
  1. \r\n \">\r\n No Title\r\n
    \r\n \r\n
    \r\n
    \r\n Namespace: \r\n
    \r\n
    \r\n
    \r\n
  2. \r\n
    \r\n\r\n
\r\n\n\n\n\n
\n · · \n
\n
\n','IndexedSearch'); +INSERT INTO template VALUES (1,'Default Search','\r\n

\r\n
\r\n\r\n\r\n

\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n

\r\n
\r\n \r\n \r\n \r\n \">\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \' name=\"query\">\r\n
\r\n \r\n \" \r\n \r\n \r\n \r\n checked=\"1\"\r\n \r\n \r\n checked=\"1\"\r\n \r\n \r\n checked=\"1\"\r\n \r\n >\r\n
\r\n
\r\n
\r\n \r\n \r\n \"\r\n \r\n \r\n \r\n checked=\"1\"\r\n \r\n \r\n checked=\"1\"\r\n \r\n \r\n checked=\"1\"\r\n \r\n >\r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n

\r\n\r\n

Results - of about \r\n containing \"\". Search took seconds.

\r\n
    \">\r\n \r\n
  1. \r\n \">\r\n No Title\r\n
    \r\n \r\n
    \r\n
    \r\n Location: \r\n
    \r\n
    \r\n
    \r\n
  2. \r\n
    \r\n
\r\n
\n\n\n\n
\n · · \n
\n
\n','IndexedSearch'); + diff --git a/etc/WebGUI.conf.original b/etc/WebGUI.conf.original index 344c2e5c6..1166fd2ed 100644 --- a/etc/WebGUI.conf.original +++ b/etc/WebGUI.conf.original @@ -22,7 +22,7 @@ authMethods = LDAP, WebGUI wobjects = Article, EventsCalendar, FileManager, HttpProxy, \ DataForm, MessageBoard, Poll, Product, SiteMap, \ SQLReport, Survey, SyndicatedContent, USS, WobjectProxy, \ - WSClient + WSClient, IndexedSearch macros = a => a_account, \ AdminBar => AdminBar, \ diff --git a/lib/WebGUI/Wobject.pm b/lib/WebGUI/Wobject.pm index 81e65647c..4be792b79 100644 --- a/lib/WebGUI/Wobject.pm +++ b/lib/WebGUI/Wobject.pm @@ -338,6 +338,18 @@ sub getDefaultValue { } +#------------------------------------------------------------------- + +=head2 getIndexerParams ( ) + +Override this method and return a hash reference that includes the properties necessary to index the content of the wobject. + +=cut + +sub getIndexerParams { + return {}; +} + #------------------------------------------------------------------- =head2 getValue ( propertyName ) diff --git a/lib/WebGUI/Wobject/DataForm.pm b/lib/WebGUI/Wobject/DataForm.pm index ed6d07cd5..078c726e4 100644 --- a/lib/WebGUI/Wobject/DataForm.pm +++ b/lib/WebGUI/Wobject/DataForm.pm @@ -124,6 +124,64 @@ sub duplicate { $sth->finish; } +#------------------------------------------------------------------- +sub getIndexerParams { + my $self = shift; + my $now = shift; + return { + DataForm_field => { + sql => "select DataForm_field.label as label, + DataForm_field.subtext as subtext, + DataForm_field.possibleValues as possibleValues, + DataForm_field.wobjectId as wid, + DataForm_field.DataForm_fieldId as fid, + wobject.namespace as namespace, + wobject.addedBy as ownerId, + page.urlizedTitle as urlizedTitle, + page.languageId as languageId, + page.pageId as pageId, + page.groupIdView as page_groupIdView, + wobject.groupIdView as wobject_groupIdView, + 7 as wobject_special_groupIdView + from DataForm_field, wobject, page + where DataForm_field.wobjectId = wobject.wobjectId + and wobject.pageId = page.pageId + and wobject.startDate < $now + and wobject.endDate > $now + and page.startDate < $now + and page.endDate > $now", + fieldsToIndex => ["label", "subtext", "possibleValues"], + contentType => 'wobjectDetail', + url => '$data{urlizedTitle}."#".$data{wid}', + headerShortcut => 'select label from DataForm_field where DataForm_fieldId = $data{fid}', + bodyShortcut => 'select subtext from DataForm_field where DataForm_fieldId = $data{fid}', + }, + DataForm_entryData => { + sql => "select distinct(DataForm_entryData.wobjectId) as wid, + wobject.namespace as namespace, + wobject.addedBy as ownerId, + page.urlizedTitle as urlizedTitle, + page.languageId as languageId, + page.pageId as pageId, + page.groupIdView as page_groupIdView, + wobject.groupIdView as wobject_groupIdView, + wobject.groupIdEdit as wobject_special_groupIdView + from DataForm_entryData, wobject, page + where DataForm_entryData.wobjectId = wobject.wobjectId + and wobject.pageId = page.pageId + and wobject.startDate < $now + and wobject.endDate > $now + and page.startDate < $now + and page.endDate > $now", + fieldsToIndex => ['select distinct(value) from DataForm_entryData where wobjectId = $data{wid}'], + contentType => 'wobjectDetail', + url => 'WebGUI::URL::append($data{urlizedTitle}, "func=view&entryId=list&wid=$data{wid}")', + headerShortcut => 'select title from wobject where wobjectId = $data{wid}', + } + }; +} + + #------------------------------------------------------------------- sub getListTemplateVars { my $self = shift; diff --git a/lib/WebGUI/Wobject/EventsCalendar.pm b/lib/WebGUI/Wobject/EventsCalendar.pm index 225aeb8e8..184604569 100644 --- a/lib/WebGUI/Wobject/EventsCalendar.pm +++ b/lib/WebGUI/Wobject/EventsCalendar.pm @@ -47,6 +47,41 @@ sub duplicate { $sth->finish; } +#------------------------------------------------------------------- +sub getIndexerParams { + my $self = shift; + my $now = shift; + return { + EventsCalendar => { + sql => "select EventsCalendar_event.EventsCalendar_eventId as eid, + EventsCalendar_event.wobjectId as wid, + EventsCalendar_event.name as name, + EventsCalendar_event.description as description, + wobject.namespace as namespace, + wobject.addedBy as ownerId, + page.urlizedTitle as urlizedTitle, + page.languageId as languageId, + page.pageId as pageId, + page.groupIdView as page_groupIdView, + wobject.groupIdView as wobject_groupIdView, + 7 as wobject_special_groupIdView + from EventsCalendar_event, wobject, page + where EventsCalendar_event.wobjectId = wobject.wobjectId + and wobject.pageId = page.pageId + and wobject.startDate < $now + and wobject.endDate > $now + and page.startDate < $now + and page.endDate > $now", + fieldsToIndex => ["description", "name"], + contentType => 'wobjectDetail', + url => 'WebGUI::URL::append($data{urlizedTitle},"func=viewEvent&wid=$data{wid}&eid=$data{eid}")', + headerShortcut => 'select name from EventsCalendar_event where EventsCalendar_eventId=$data{eid}', + bodyShortcut => 'select description from EventsCalendar_event where EventsCalendar_eventId=$data{eid}', + } + }; +} + + #------------------------------------------------------------------- sub name { return WebGUI::International::get(2,$_[0]->get("namespace")); diff --git a/lib/WebGUI/Wobject/FileManager.pm b/lib/WebGUI/Wobject/FileManager.pm index a170eb7ce..4ae7c8e19 100644 --- a/lib/WebGUI/Wobject/FileManager.pm +++ b/lib/WebGUI/Wobject/FileManager.pm @@ -59,6 +59,44 @@ sub duplicate { $sth->finish; } +#------------------------------------------------------------------- +sub getIndexerParams { + my $self = shift; + my $now = shift; + return { + FileManager_file => { + sql => "select FileManager_file.wobjectId as wid, + FileManager_file.fileTitle as fileTitle, + FileManager_file.downloadFile as downloadFile, + FileManager_file.briefSynopsis as briefSynopsis, + FileManager_file.alternateVersion1 as alternateVersion1, + FileManager_file.alternateVersion2 as alternateVersion2, + FileManager_file.FileManager_fileId as fid, + wobject.addedBy as ownerId, + wobject.namespace as namespace, + page.urlizedTitle as urlizedTitle, + page.languageId as languageId, + page.pageId as pageId, + page.groupIdView as page_groupIdView, + wobject.groupIdView as wobject_groupIdView, + FileManager_file.groupToView as wobject_special_groupIdView + from FileManager_file, wobject, page + where FileManager_file.wobjectId = wobject.wobjectId + and wobject.pageId = page.pageId + and wobject.startDate < $now + and wobject.endDate > $now + and page.startDate < $now + and page.endDate > $now", + fieldsToIndex => ["fileTitle", "downloadFile", "briefSynopsis", "alternateVersion1", "alternateVersion2"], + contentType => 'wobjectDetail', + url => '$data{urlizedTitle}."#".$data{wid}', + headerShortcut => 'select fileTitle from FileManager_file where FileManager_fileId = $data{fid}', + bodyShortcut => 'select briefSynopsis from FileManager_file where FileManager_fileId = $data{fid}', + } + }; +} + + #------------------------------------------------------------------- sub name { return WebGUI::International::get(1,$_[0]->get("namespace")); diff --git a/lib/WebGUI/Wobject/MessageBoard.pm b/lib/WebGUI/Wobject/MessageBoard.pm index 8dd6f7e29..39cbf533d 100644 --- a/lib/WebGUI/Wobject/MessageBoard.pm +++ b/lib/WebGUI/Wobject/MessageBoard.pm @@ -39,6 +39,71 @@ sub _formatControls { } +#------------------------------------------------------------------- +sub getIndexerParams { + my $self = shift; + my $now = shift; + return { + MessageBoard => { + sql => "select MessageBoard_forums.title, + MessageBoard_forums.description, + MessageBoard_forums.wobjectId as wid, + wobject.namespace as namespace, + wobject.addedBy as ownerId, + page.urlizedTitle as urlizedTitle, + page.languageId as languageId, + page.pageId as pageId, + page.groupIdView as page_groupIdView, + wobject.groupIdView as wobject_groupIdView, + 7 as wobject_special_groupIdView + from MessageBoard_forums, wobject, page + where MessageBoard_forums.wobjectId = wobject.wobjectId + and wobject.pageId = page.pageId + and wobject.startDate < $now + and wobject.endDate > $now + and page.startDate < $now + and page.endDate > $now", + fieldsToIndex => ["title", "description"], + contentType => 'wobject', + url => '$data{urlizedTitle}."#".$data{wid}', + headerShortcut => 'select title from MessageBoard_forums where wobjectId = $data{wid}', + bodyShortcut => 'select description from MessageBoard_forums where wobjectId = $data{wid}', + }, + MessageBoard_Forum => { + sql => "select forumPost.forumPostId, + forumPost.username, + forumPost.subject, + forumPost.message, + forumPost.userId as ownerId, + forumThread.forumId as forumId, + MessageBoard_forums.wobjectId, + wobject.namespace as namespace, + wobject.wobjectId as wid, + page.urlizedTitle as urlizedTitle, + page.languageId as languageId, + page.pageId as pageId, + page.groupIdView as page_groupIdView, + wobject.groupIdView as wobject_groupIdView, + 7 as wobject_special_groupIdView + from forumPost, forumThread, MessageBoard_forums, wobject, page + where forumPost.forumThreadId = forumThread.forumThreadId + and forumThread.forumId = MessageBoard_forums.forumId + and MessageBoard_forums.wobjectId = wobject.wobjectId + and wobject.pageId = page.pageId + and wobject.startDate < $now + and wobject.endDate > $now + and page.startDate < $now + and page.endDate > $now", + fieldsToIndex => ["username", "subject", "message"], + contentType => 'discussion', + url => 'WebGUI::URL::append($data{urlizedTitle},"func=view&wid=$data{wid}&forumOp=viewThread&forumPostId=$data{forumPostId}&forumId=$data{forumId}")', + headerShortcut => 'select subject from forumPost where forumPostId = $data{forumPostId}', + bodyShortcut => 'select message from forumPost where forumPostId = $data{forumPostId}', + } + }; +} + + #------------------------------------------------------------------- sub name { return WebGUI::International::get(2,$_[0]->get("namespace")); diff --git a/lib/WebGUI/Wobject/Poll.pm b/lib/WebGUI/Wobject/Poll.pm index dd334f657..6078efc72 100644 --- a/lib/WebGUI/Wobject/Poll.pm +++ b/lib/WebGUI/Wobject/Poll.pm @@ -46,6 +46,44 @@ sub duplicate { $sth->finish; } +#------------------------------------------------------------------- +sub getIndexerParams { + my $self = shift; + my $now = shift; + return { + Poll => { + sql => "select Poll.wobjectId as wid, + Poll.question as question, + Poll.a1 as a1, Poll.a2 as a2, Poll.a3 as a3, Poll.a4 as a4, Poll.a5 as a5, + Poll.a6 as a6, Poll.a7 as a7, Poll.a8 as a8, Poll.a9 as a9, Poll.a10 as a10, + Poll.a11 as a11, Poll.a12 as a12, Poll.a13 as a13, Poll.a14 as a14, Poll.a15 as a15, + Poll.a16 as a16, Poll.a17 as a17, Poll.a18 as a18, Poll.a19 as a19, Poll.a20 as a20, + wobject.namespace as namespace, + wobject.addedBy as ownerId, + page.urlizedTitle as urlizedTitle, + page.languageId as languageId, + page.pageId as pageId, + page.groupIdView as page_groupIdView, + wobject.groupIdView as wobject_groupIdView, + 7 as wobject_special_groupIdView + from Poll, wobject, page + where Poll.wobjectId = wobject.wobjectId + and wobject.pageId = page.pageId + and wobject.startDate < $now + and wobject.endDate > $now + and page.startDate < $now + and page.endDate > $now", + fieldsToIndex => ["question", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", + "a11", "a12", "a13", "a14", "a15", "a16", "a17", "a18", "a19", "a20"], + contentType => 'wobjectDetail', + url => 'WebGUI::URL::append($data{urlizedTitle}, "func=view&wid=$data{wid}")', + headerShortcut => 'select question from Poll where wobjectId = $data{wid}', + bodyShortcut => 'select a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20 + from Poll where wobjectId = $data{wid}', + } + }; +} + #------------------------------------------------------------------- sub name { return WebGUI::International::get(1,$_[0]->get("namespace")); diff --git a/lib/WebGUI/Wobject/Product.pm b/lib/WebGUI/Wobject/Product.pm index 815e39b0e..9c3534c64 100644 --- a/lib/WebGUI/Wobject/Product.pm +++ b/lib/WebGUI/Wobject/Product.pm @@ -74,6 +74,54 @@ sub duplicate { $sth->finish; } +#------------------------------------------------------------------- +sub getIndexerParams { + my $self = shift; + my $now = shift; + return { + Product => { + sql => "select Product.wobjectId as wid, + Product.image1 as image1, + Product.image2 as image2, + Product.image3 as image3, + Product.brochure as brochure, + Product.manual as manual, + Product.warranty as warranty, + Product.price as price, + Product.productNumber as productNumber, + Product_benefit.benefit as benefit, + Product_feature.feature as feature, + Product_specification.name as name, + Product_specification.value as value, + Product_specification.units as units, + wobject.namespace as namespace, + wobject.addedBy as ownerId, + page.urlizedTitle as urlizedTitle, + page.languageId as languageId, + page.pageId as pageId, + page.groupIdView as page_groupIdView, + wobject.groupIdView as wobject_groupIdView, + 7 as wobject_special_groupIdView + from Product, wobject, page + left join Product_benefit on Product_benefit.wobjectId=Product.wobjectId + left join Product_feature on Product_feature.wobjectId=Product.wobjectId + left join Product_specification on Product_specification.wobjectId=Product.wobjectId + where Product.wobjectId = wobject.wobjectId + and wobject.pageId = page.pageId + and wobject.startDate < $now + and wobject.endDate > $now + and page.startDate < $now + and page.endDate > $now", + fieldsToIndex => ["image1", "image2", "image3", "brochure", "manual", "warranty", "price", + "productNumber", "benefit", "feature", "name", "value", "units"], + contentType => 'wobjectDetail', + url => 'WebGUI::URL::append($data{urlizedTitle}, "func=view&wid=$data{wid}")', + headerShortcut => 'select title from wobject where wobjectId = $data{wid}', + bodyShortcut => 'select description from wobject where wobjectId = $data{wid}', + } + }; +} + #------------------------------------------------------------------- sub name { return WebGUI::International::get(1,$_[0]->get("namespace")); diff --git a/lib/WebGUI/Wobject/Survey.pm b/lib/WebGUI/Wobject/Survey.pm index af21e27ff..46407133d 100644 --- a/lib/WebGUI/Wobject/Survey.pm +++ b/lib/WebGUI/Wobject/Survey.pm @@ -108,6 +108,43 @@ sub generateResponseId { return $session{scratch}{$varname}; } +#------------------------------------------------------------------- +sub getIndexerParams { + my $self = shift; + my $now = shift; + return { + Survey => { + sql => "select Survey_question.question as question, + Survey_question.Survey_questionId as Survey_questionId, + Survey.wobjectId as wid, + wobject.namespace as namespace, + wobject.addedBy as ownerId, + page.urlizedTitle as urlizedTitle, + page.languageId as languageId, + page.pageId as pageId, + page.groupIdView as page_groupIdView, + wobject.groupIdView as wobject_groupIdView, + Survey.groupToTakeSurvey as wobject_special_groupIdView + from wobject, page, Survey + left join Survey_question on Survey_question.Survey_id=Survey.Survey_id + where Survey.wobjectId = wobject.wobjectId + and wobject.pageId = page.pageId + and wobject.startDate < $now + and wobject.endDate > $now + and page.startDate < $now + and page.endDate > $now", + fieldsToIndex => ["question", + 'select answer from Survey_answer where Survey_questionId = $data{Survey_questionId}' ], + contentType => 'wobjectDetail', + url => 'WebGUI::URL::append($data{urlizedTitle}, "func=view&wid=$data{wid}")', + headerShortcut => 'select title from wobject where wobjectId = $data{wid}', + bodyShortcut => 'select description from wobject where wobjectId = $data{wid}', + + } + }; +} + + #------------------------------------------------------------------- sub getIp { my $self = shift; diff --git a/lib/WebGUI/Wobject/USS.pm b/lib/WebGUI/Wobject/USS.pm index a527ea267..cb2b62543 100644 --- a/lib/WebGUI/Wobject/USS.pm +++ b/lib/WebGUI/Wobject/USS.pm @@ -80,6 +80,77 @@ sub duplicate { $sth->finish; } +#------------------------------------------------------------------- +sub getIndexerParams { + my $self = shift; + my $now = shift; + return { + USS_discussion => { + sql => "select forumPost.forumPostId, + forumPost.username, + forumPost.subject, + forumPost.message, + forumPost.userId as ownerId, + forumThread.forumId as forumId, + USS_submission.USS_submissionId as sid, + wobject.namespace as namespace, + wobject.wobjectId as wid, + page.urlizedTitle as urlizedTitle, + page.languageId as languageId, + page.pageId as pageId, + page.groupIdView as page_groupIdView, + wobject.groupIdView as wobject_groupIdView, + 7 as wobject_special_groupIdView + from forumPost, forumThread, USS_submission, wobject, page, USS + where forumPost.forumThreadId = forumThread.forumThreadId + and forumThread.forumId = USS_submission.forumId + and USS_submission.USS_id = USS.USS_id + and USS.wobjectId = wobject.wobjectId + and wobject.pageId = page.pageId + and wobject.startDate < $now + and wobject.endDate > $now + and page.startDate < $now + and page.endDate > $now", + fieldsToIndex => ["username", "subject", "message"], + contentType => 'discussion', + url => 'WebGUI::URL::append($data{urlizedTitle},"func=viewSubmission&wid=$data{wid}&sid=$data{sid}&forumOp=viewThread&forumPostId=$data{forumPostId}&forumId=$data{forumId}")', + headerShortcut => 'select subject from forumPost where forumPostId = $data{forumPostId}', + bodyShortcut => 'select message from forumPost where forumPostId = $data{forumPostId}', + }, + USS_submission => { + sql => "select USS_submission.title as title, + USS_submission.username as username, + USS_submission.content as content, + USS_submission.image as image, + USS_submission.attachment as attachment, + USS.wobjectId as wid, + USS_submission.USS_submissionId as sid, + USS_submission.userId as ownerId, + wobject.namespace as namespace, + page.urlizedTitle as urlizedTitle, + page.languageId as languageId, + page.pageId as pageId, + page.groupIdView as page_groupIdView, + wobject.groupIdView as wobject_groupIdView, + 7 as wobject_special_groupIdView + from wobject, page, USS_submission, USS + where USS_submission.USS_id = USS.USS_id + and USS.wobjectId = wobject.wobjectId + and wobject.pageId = page.pageId + and USS_submission.status = 'Approved' + and wobject.startDate < $now + and wobject.endDate > $now + and page.startDate < $now + and page.endDate > $now", + fieldsToIndex => ["username", "title", "content", "image", "attachment"], + contentType => 'wobjectDetail', + url => 'WebGUI::URL::append($data{urlizedTitle}, "func=viewSubmission&wid=$data{wid}&sid=$data{sid}")', + headerShortcut => 'select title from USS_submission where USS_submissionId = $data{sid}', + bodyShortcut => 'select content from USS_submission where USS_submissionId = $data{sid}', + } + }; +} + #------------------------------------------------------------------- sub name { return WebGUI::International::get(29,$_[0]->get("namespace")); diff --git a/sbin/runHourly.pl b/sbin/runHourly.pl index ac2400067..8effa0339 100644 --- a/sbin/runHourly.pl +++ b/sbin/runHourly.pl @@ -94,7 +94,7 @@ if (opendir (CONFDIR,$confdir)) { $exclude =~ s/ //g; unless (isIn($namespace, split(/,/,$exclude))) { $cmd = $plugins{$namespace}; - &$cmd(); + &$cmd($verbose); } print " (".($currentTime-$previousTime)." seconds)\n" if ($verbose); $previousTime = $currentTime;