Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Re: Keyword Tracker and SQL

Quote Reply
Re: Keyword Tracker and SQL In reply to
With version 1.02 out, I sat down to figure out the rules of the road, so to speak. Keyword logging should be just a simple subroutine call:

if exists 'keyword' increment count,
otherwise, add new record
return

Well.... it was all that and more <G>

The table I used is very simple:

Code:
#
# Host: localhost Database : links
# --------------------------------------------------------

#
# Table structure for table 'Search_Log'
#

CREATE TABLE Search_Log (
ID int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
Term char(25) NOT NULL,
Count int(11) DEFAULT '0' NOT NULL,
Last_Look bigint(21) DEFAULT '0' NOT NULL,
PRIMARY KEY (ID),
UNIQUE Term (Term)
);

The above code will actually create the database table if used in the SQL command box. You can change the table name, but "Search_Log" was pretty intuitive.

The Search_Log.def file is:

Code:
# Auto Generated Config File.
# Created on: Mon Aug 23 21:52:54 1999
#

package Links: Smile
foreach $hit_arr(@$hits){
my $hit_hash =$db_table->array_to_hash($hit_arr); ## convert array to hash
$hit_hash->{'Count'} = $hit_hash->{'Count'} + 1; ## increment _Count_ field
$db_table->modify_record($hit_hash); ## send hash to _modify_
}
} else { ## more than one record found
## database contained multiple matches... error
print "Hit my only error condition found";
&site_html_search_failure ({ error => "More than one exact database match.", %in }) and return;
} ## if_elseif

} ## log_search

No utilties yet, but this does the job...
I'm sure it could be done in fewer lines, and with neater calls, but this explains the logic, at least. The kludge is that I still had not figured out all the calls, so I just used Alex's boilerplate.

---

BTW: Alex... smiley's are cute, but they affect the programming -- BSQL becomes {confused smiley}BSQL


[This message has been edited by pugdog (edited August 23, 1999).]
Subject Author Views Date
Thread Keyword Tracker and SQL search 4443 Jul 28, 1999, 11:44 PM
Post Re: Keyword Tracker and SQL
pugdog 4360 Jul 29, 1999, 7:39 AM
Post Re: Keyword Tracker and SQL
search 4371 Aug 5, 1999, 2:52 AM
Post Re: Keyword Tracker and SQL
pugdog 4358 Aug 5, 1999, 8:01 AM
Post Re: Keyword Tracker and SQL
search 4351 Aug 6, 1999, 2:42 AM
Post Re: Keyword Tracker and SQL
pugdog 4355 Aug 6, 1999, 11:16 AM
Post Re: Keyword Tracker and SQL
pugdog 4362 Aug 23, 1999, 4:14 PM
Post Re: Keyword Tracker and SQL
Synesthesia 4354 Aug 23, 1999, 4:35 PM
Post Re: Keyword Tracker and SQL
Alex 4352 Aug 23, 1999, 4:36 PM
Post Re: Keyword Tracker and SQL
pugdog 4363 Aug 24, 1999, 9:12 AM