adding search engine

This commit is contained in:
JT Smith 2004-02-29 04:05:12 +00:00
parent 314d8daacb
commit ef8e8704c5
14 changed files with 535 additions and 3 deletions

View file

@ -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.

View file

@ -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);

File diff suppressed because one or more lines are too long

View file

@ -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, \

View file

@ -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 )

View file

@ -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;

View file

@ -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"));

View file

@ -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"));

View file

@ -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"));

View file

@ -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"));

View file

@ -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"));

View file

@ -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;

View file

@ -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"));

View file

@ -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;