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

Category Search - once again!

Quote Reply
Category Search - once again!
Hi,

I have found a "solution" in this thread:

http://www.gossamer-threads.com/...um9/HTML/000204.html

But I am already using the latest version 1.11 und the explained code is not working there :-(

Has anyone a new solution?

THANKS!

Bye,
Danny

------------------
Quote Reply
Re: Category Search - once again! In reply to
i figured out how to do it in 1.11.. but it's not that great...

add to my list at top..
Code:
, $cat

add this..
Code:
($in->param('category') =~ /^(\d+)$/) and ($cat = $1);

under
Code:
($in->param('order') =~ /^(score|category)$/i) ? ($order = uc $1) : ($order = 'CATEGORY');

add..

Code:
# Build a hash of the category and subcategories.
my (%categories);
if ($cat) {
$categories{$cat}++;
my $sth = $catdb->prepare ("SELECT SubCategoryID FROM CategoryHierarchy WHERE CategoryID = $cat");
$sth->execute() or die $DBI::errstr;
while (my ($id) = $sth->fetchrow_array) { $categories{$id}++; }
}

under..
Code:
# Return if we don't have any matches.
unless ($link_count or $cat_count) {
&log_query ($in->param('query'), 0);
&site_html_search_failure ({ error => "No matching links.", ignored => $ignored, %in }, $dynamic);
return;
}

under..

Code:
$hit = $catdb->array_to_hash($hit);

add
Code:
if ($cat && !$categories{$hit->{ID}}) { $cat_count--; next; }

under
Code:
$hit = $linkdb->array_to_hash ($hit);

add
Code:
if ($cat && !$categories{$hit->{CategoryID}}) { $link_count--; next; }

------------------
Jerry Su
Links SQL User
------------------
Quote Reply
Re: Category Search - once again! In reply to
Has anyone done this?
'cause it doesn't work for me.

thanks
Quote Reply
Re: Category Search - once again! In reply to
search in certain categories.. i was able to do this in the non indexed search.cgi..

you could use perl to filter out the links while they are formatted in search.cgi.. but that is too lame.. i won't be surprised to see somebody doing that.. it's the dumbest way to do it in my opinion..

jerry
Quote Reply
Re: Category Search - once again! In reply to
so.. This is not a good solution after all.

jerry, can i have your delete.cgi file ? it's user modify mod you've create, please kindly send it to ryan@subvet.com

thank you all
Quote Reply
Re: Category Search - once again! In reply to
What are you trying to do? What exactly.
Quote Reply
Re: Category Search - once again! In reply to
jerry, can i have your delete.cgi file ? it's user modify mod you've create, where can I download it ?

Thanks