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

creating multiple searches with multipe databases

Quote Reply
creating multiple searches with multipe databases
Hello everyone!

Here is my plan: I have a LinkSearch, JokeSearch, PeopleSearch, and MusicSearch on my site and I want them all run by Links SQL. Each has there own MySql database. I have the LinkSearch running fine. I'm starting the implement of the other searches with the JokeSearch and if I'm successful, I'll do the other two. How I plan to do this:

1) Setup Database

modify setup.cgi to be jokesetup.cgi: Change all the occurances of 'setup.cgi' inside the script to be 'jokesetup.cgi' and change all the occurances of '/defs/Whatever.def' to be '/defs/JokeWhatever.def' and save

modify Import.pl to JokeImport.pl: Change all occurances of '/defs/Whatever.def' to be '/defs/JokeWhatever.def'

modfiy SQL.mysql to be JokeSQL.mysql: add a field for the Joke in Links Table and delete the table for Subscribes (no use for it) and remove the variable for Subscribers from %TABLES at the bottom

run jokesetup.cgi: create .def's and tables in MySql database named 'jokesearch'

2) Make Public CGI's Multiple Search Useable

edit add.cgi, modify.cgi, search.cgi, etc.: use a QUERY_STRING command to determine which database to add to or search (so if search.cgi is called with search.cgi?jokesearch, it will search the MySql database named 'jokesearch'). one example: search.cgi. i'll add:

use Links::Joke_DBSQL;
use Links::Joke_DB_Utils;
use Links::Joke_HTML_Templates;


to the required modules and then use if statements to call the required templates, .def file, database, or variable, like for the search and error templates:

if ($QUERY_STRING eq "jokesearch" && $in->param('query')) {
&joke_search ($in, $dynamic);
}
elsif ($in->param('query')) {
&search ($in, $dynamic);
}
elsif ($QUERY_STRING eq "'jokesearch") {
&joke_html_search_form ( { query => '' }, $dynamic );
}
else {
&site_html_search_form ( { query => '' }, $dynamic );
}


and then make a sub joke_search and a sub joke_search_build_linked_title and sub joke_log_query that pertain to the jokesearch and do likewise for the other public .cgi's

3) the admin area

make .pm files for the JokeSearch in the Links directory: put new path of .def's

add variables for the JokeSearch in Links.pm: url and path of directory to build jokesearch and then url and pathes for New, Cool, and Ratings

create a nph-build.cgi for JokeSearch: calls all the right joke subroutines and variables

create a nph-index.cgi for JokeSearch: create a subroutine that will index the jokesearch mysql database and use a $QUERY_STRING to tell which subroutine to use



there is more to do but I keep realizing that is basically just making another version of Links SQL. I'n hoping that someone has a better way of doing this. Before I got SQL, I had made a thread in the SQL Questions about this, and AnthroRules gave this:

http://www.gossamer-threads.com/...=&vc=1#Post99073

Thanks for any input! I plan to post more as I start to play with this idea. God bless!


<><------------><>
Daniel
http://www.christian-search.net
<><------------><>
Quote Reply
Re: creating multiple searches with multipe databases In reply to
i've started the first of this process by setting up setup.cgi/Import.pl version for the jokesearch

the problem I've run into is that in the Links 2.0 version of the JokeSearch, a URL wasn't required but it is for the Import. What can I do to make to not required to import? Thanks!

<><------------><>
Daniel
http://www.christian-search.net
<><------------><>
Quote Reply
Re: creating multiple searches with multipe databases In reply to
Change the required column (third one before the end column) in the Links.def file to 0 rather than 1.

Example:

'0','','^http|ftp|mailto']

Regards,

Eliot Lee
Quote Reply
Re: creating multiple searches with multipe databases In reply to
I already have it like that. It was set to 0 when I was using it for Links 2.0.

What I have:

%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Title => [1, 'alpha', 40, 75, 1, '', ''],
URL => [2, 'alpha', 40, 75, 0, 'http://', '^http|news|mailto|ftp'],
Date => [3, 'date', 15, 15, 1, \&get_date, ''],
Category => [4, 'alpha', 0, 150, 1, '', ''],
Description => [5, 'alpha', 40, 150, 0, '', ''],
'Contact Name' => [6, 'alpha', 40, 75, 1, '', ''],
'Contact Email' => [7, 'alpha', 40, 75, 0, '', '.+@.+\..+'],
Hits => [8, 'numer', 10, 10, 0, '0', '\d+'],
isNew => [9, 'alpha', 0, 5, 1, 'Yes', ''],
isPopular => [10, 'alpha', 0, 5, 0, 'No', ''],
Rating => [11, 'numer', 10, 10, 1, 0, '^[\d\.]+$'],
Votes => [12, 'numer', 10, 10, 1, 0, '^\d+$'],
ReceiveMail => [13, 'alpha', 10, 10, 1, 'Yes', 'No|Yes'],
Joke => [14, 'alpha', '40x4',5500, 1, '', '']
);


i'm thinking it has to do with something in DBSQL.pm, Import.pl calls it for information. Ideas?


<><------------><>
Daniel
http://www.christian-search.net
<><------------><>
Quote Reply
Re: creating multiple searches with multipe databases In reply to
In the SQL.mysql file, you need to change the URL definition in the Links table configurations.

Regards,

Eliot Lee
Quote Reply
Re: creating multiple searches with multipe databases In reply to
It says:

URL CHAR(150) NOT NULL,

I tried taking out the NOT NULL but that didn't work, it still gave me the error for URL not found.

Thanks for the help!

<><------------><>
Daniel
http://www.christian-search.net
<><------------><>