Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Search with 'catid'... but you have to define 'query'?

Quote Reply
Search with 'catid'... but you have to define 'query'?
Hi. I'm just having a play with the 'search by category' feature. I have basically added a new global, which prints a dropdown box of categories. You then click 'list', and it *should* give you a list of the results from that category. I am using something like;

search.cgi?d=1&query=&catid=2

If I change this to: search.cgi?d=1&query=t&catid=2

...it comes up with the results fine (cos its matching the 't' in the link titles).

Is this a feature, or bug? (i.e it won't let you just search by category, if no query is defined).

TIA

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Search with 'catid'... but you have to define 'query'? In reply to
For anyone interested, here is a quick fix that I managed to apply (seems to be working);

In /admin/Links/Users/Search.pm, find;

Code:
# If query is set we know we are searching.
defined $args->{'query'} and ($args->{query} =~ /\S/) and return search();

...and replace with;

Code:
# If query is set we know we are searching.
defined $args->{'query'} or $args->{'catid'} and return search();

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Search with 'catid'... but you have to define 'query'? In reply to
Ignore that. Simple add this;

Code:
defined $args->{'catid'} and ($args->{catid} =~ /\d/) and return search();

...before....

Code:
defined $args->{'query'} and ($args->{query} =~ /\S/) and return search();

The other code seemed to skew up the search results for normal search queries :(

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!