fixing search bugs

This commit is contained in:
JT Smith 2004-02-29 20:42:12 +00:00
parent 2d28c61ec4
commit 835292986a
4 changed files with 23 additions and 10 deletions

View file

@ -665,7 +665,7 @@ delete from international where internationalId=365 and namespace='WebGUI';
delete from international where internationalId=366 and namespace='WebGUI';
delete from international where internationalId=910 and namespace='WebGUI';
delete from international where internationalId=912 and namespace='WebGUI';
alter table IndexedSearch_docInfo add column dateIndexed int not null;
INSERT INTO template VALUES (14,'Job Listing','<tmpl_if displayTitle>\n <h1><tmpl_var title></h1>\n</tmpl_if>\n\n<tmpl_if description>\n <tmpl_var description><p />\n</tmpl_if>\n\n<tmpl_if session.scratch.search>\n <tmpl_var search.form>\n</tmpl_if>\n\n<table width=\"100%\" cellpadding=2 cellspacing=1 border=0><tr>\n<td align=\"right\" class=\"tableMenu\">\n\n<tmpl_if canPost>\n <a href=\"<tmpl_var post.url>\">Add a job.</a> &middot;\n</tmpl_if>\n\n<a href=\"<tmpl_var search.url>\"><tmpl_var search.label></a>\n\n</td></tr></table>\n\n<table width=\"100%\" cellspacing=1 cellpadding=2 border=0>\n<tr>\n<td class=\"tableHeader\">Job Title</td>\n<td class=\"tableHeader\">Location</td>\n<td class=\"tableHeader\">Compensation</td>\n<td class=\"tableHeader\">Date Posted</td>\n</tr>\n\n<tmpl_loop submissions_loop>\n\n<tr>\n<td class=\"tableData\">\n <a href=\"<tmpl_var submission.URL>\"> <tmpl_var submission.title>\n</td>\n<td class=\"tableData\"><tmpl_var submission.userDefined2></td>\n<td class=\"tableData\"><tmpl_var submission.userDefined1></td>\n<td class=\"tableData\"><tmpl_var submission.date></td>\n</tr>\n\n</tmpl_loop>\n\n</table>\n\n<tmpl_if multiplePages>\n <div class=\"pagination\">\n <tmpl_var previousPage> &middot; <tmpl_var pageList> &middot; <tmpl_var nextPage>\n </div>\n</tmpl_if>\n','USS');
INSERT INTO template VALUES (2,'Job','<h1><tmpl_var title></h1>\n\n<tmpl_if content>\n<p>\n<b>Job Description</b><br />\n<tmpl_var content>\n</p>\n</tmpl_if>\n\n<tmpl_if userDefined3.value>\n<p>\n<b>Job Requirements</b><br />\n<tmpl_var userDefined3.value>\n</p>\n</tmpl_if>\n\n<table>\n<tr>\n <td class=\"tableHeader\">Date Posted</td>\n <td class=\"tableData\"><tmpl_var date.human></td>\n</tr>\n<tr>\n <td class=\"tableHeader\">Location</td>\n <td class=\"tableData\"><tmpl_var userDefined2.value></td>\n</tr>\n<tr>\n <td class=\"tableHeader\">Compensation</td>\n <td class=\"tableData\"><tmpl_var userDefined1.value></td>\n</tr>\n<tr>\n <td class=\"tableHeader\">Views</td>\n <td class=\"tableData\"><tmpl_var views.count></td>\n</tr>\n</table>\n\n<p>\n<tmpl_if previous.more>\n <a href=\"<tmpl_var previous.url>\">&laquo; Previous Job</a> &middot;\n</tmpl_if>\n<a href=\"<tmpl_var back.url>\">List All Jobs</a>\n<tmpl_if next.more>\n &middot; <a href=\"<tmpl_var next.url>\">Next Job &raquo;</a>\n</tmpl_if>\n</p>\n\n\n<tmpl_if canEdit>\n<p>\n <a href=\"<tmpl_var edit.url>\">Edit</a>\n &middot;\n <a href=\"<tmpl_var delete.url>\"><tmpl_var delete.label></a>\n</p>\n</tmpl_if>\n\n<tmpl_if canChangeStatus>\n <p>\n<b>Status:</b> <tmpl_var status.status> ||\n <a href=\"<tmpl_var approve.url>\"><tmpl_var approve.label></a>\n &middot;\n <a href=\"<tmpl_var deny.url>\"><tmpl_var deny.label></a>\n </p>\n</tmpl_if>\n\n\n\n','USS/Submission');

View file

@ -116,12 +116,17 @@ sub www_edit {
}
# Index to use
$properties->radioList( -name=>'indexName',
-options=>\%indexName,
-label=>WebGUI::International::get(5,$self->get("namespace")),
-value=>$self->getValue("indexName"),
-vertical=>1
);
# $properties->radioList( -name=>'indexName',
# -options=>\%indexName,
# -label=>WebGUI::International::get(5,$self->get("namespace")),
# -value=>$self->getValue("indexName"),
# -vertical=>1
# );
# NOTE: For now we're limiting each site to one index. Will allow more in the future.
$properties->hidden(
-name=>"indexName",
-value=>"IndexedSearch_default"
);
# Page roots
%searchRoot = ( 'any'=>WebGUI::International::get(15,$self->get("namespace")),

View file

@ -16,6 +16,7 @@ package WebGUI::Wobject::IndexedSearch::Search;
use strict;
use DBIx::FullTextSearch;
use WebGUI::DateTime;
use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::HTML;
@ -436,7 +437,8 @@ sub indexDocument {
headerShortcut,
bodyShortcut,
contentType,
ownerId )
ownerId,
dateIndexed )
values ( ".
($document->{docId} || $self->{_docId}).", ".
quote($self->getIndexName).", ".
@ -451,7 +453,8 @@ sub indexDocument {
quote($document->{headerShortcut})." ,".
quote($document->{bodyShortcut})." ,".
quote($document->{contentType})." ,".
($document->{ownerId} || 3)." )"
($document->{ownerId} || 3).",
".WebGUI::DateTime::time()." )"
);
$self->{_docId}++;
}

View file

@ -23,8 +23,13 @@ use WebGUI::Wobject::IndexedSearch::Search;
#-------------------------------------------------------------------
sub process {
my $verbose = shift;
print "\n";
my $indexName = 'IndexedSearch_default';
my ($dateIndexed) = WebGUI::SQL->quickArray("select max(dateIndexed) from IndexedSearch_docInfo where indexName = ".quote($indexName));
if (WebGUI::DateTime::time()-$dateIndexed < 86400) {
print " - Recently Indexed: Skipping " if ($verbose);
return "";
}
print "\n";
my $htmlFilter = 'all';
my $stopList = 'none';
undef $stopList if ($stopList eq 'none');