From 835292986a8b35b1ad7312a1cac63821ba866e57 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Sun, 29 Feb 2004 20:42:12 +0000 Subject: [PATCH] fixing search bugs --- docs/upgrades/upgrade_5.9.9-6.0.0.sql | 2 +- lib/WebGUI/Wobject/IndexedSearch.pm | 17 +++++++++++------ lib/WebGUI/Wobject/IndexedSearch/Search.pm | 7 +++++-- sbin/Hourly/IndexedSearch_buildIndex.pm | 7 ++++++- 4 files changed, 23 insertions(+), 10 deletions(-) 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 158e66315..9d88a294b 100644 --- a/docs/upgrades/upgrade_5.9.9-6.0.0.sql +++ b/docs/upgrades/upgrade_5.9.9-6.0.0.sql @@ -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','\n

\n
\n\n\n

\n\n\n\n \n\n\n\n
\n\n\n \">Add a job. ·\n\n\n\">\n\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Job TitleLocationCompensationDate Posted
\n \"> \n
\n\n\n

\n · · \n
\n
\n','USS'); INSERT INTO template VALUES (2,'Job','

\n\n\n

\nJob Description
\n\n

\n
\n\n\n

\nJob Requirements
\n\n

\n
\n\n\n\n \n \n\n\n \n \n\n\n \n \n\n\n \n \n\n
Date Posted
Location
Compensation
Views
\n\n

\n\n \">« Previous Job ·\n\n\">List All Jobs\n\n · \">Next Job »\n\n

\n\n\n\n

\n \">Edit\n ·\n \">\n

\n
\n\n\n

\nStatus: ||\n \">\n ·\n \">\n

\n
\n\n\n\n','USS/Submission'); diff --git a/lib/WebGUI/Wobject/IndexedSearch.pm b/lib/WebGUI/Wobject/IndexedSearch.pm index 8734a8569..03dd3d42e 100644 --- a/lib/WebGUI/Wobject/IndexedSearch.pm +++ b/lib/WebGUI/Wobject/IndexedSearch.pm @@ -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")), diff --git a/lib/WebGUI/Wobject/IndexedSearch/Search.pm b/lib/WebGUI/Wobject/IndexedSearch/Search.pm index 89591a823..3dc6a2f13 100644 --- a/lib/WebGUI/Wobject/IndexedSearch/Search.pm +++ b/lib/WebGUI/Wobject/IndexedSearch/Search.pm @@ -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}++; } diff --git a/sbin/Hourly/IndexedSearch_buildIndex.pm b/sbin/Hourly/IndexedSearch_buildIndex.pm index 29a824194..752c4f344 100644 --- a/sbin/Hourly/IndexedSearch_buildIndex.pm +++ b/sbin/Hourly/IndexedSearch_buildIndex.pm @@ -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');