Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Help: Extended search form?

Quote Reply
Help: Extended search form?
Hi,

i'm trying to setup a form for search.cgi like this:

search.cgi should search one field in the links table like this:

A user should enter two values (like a search for a range of ZIPs) and search.cgi should display all entries with the zip >= value1 and <= value2 ... i know how to get entries with a parameter like:

search.cgi?ZIP=12345

or

search.cgi?ZIP=>12345

but why does this not work:

search.cgi?ZIP=>12345&ZIP=<99999

?

Thanks for any hints ... i'll need both solutions - one with a direct link and one for the form ;)

Quote Reply
Re: Help: Extended search form? In reply to
Hi,

You can't pass in two ZIP = tags. To do a range search, you want to do:

search.cgi?ZIP-gt=12345&ZIP-lt=23456

to find all zip codes between 12345 and 23456. The -gt means greater than, and the -lt means less than.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Help: Extended search form? In reply to
Thanks Alex,

this should work only on a special column type (like varchar or int) or with any column types? I do have a zip-field what's defined as varchar(5) and your hint doesn't work ... any further hints?

Quote Reply
Re: Help: Extended search form? In reply to
Hi,

There is a bug in search.cgi that won't pass the search through unless you pass in a column name. Try something like:

http://www.gossamer-threads.com/...Hits-gt=50&Hits=

i.e. add an empty Zipcode= to the string.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Help: Extended search form? In reply to
Alex,

is there a bugfix available or isn't it fixed now?

I do need this feature urgent ...

Quote Reply
Re: Help: Extended search form? In reply to
Hi,

Sure, edit admin/Links/User/Search.pm around line 47 change:

if (defined $args->{$_}) {

to:

if (defined $args->{$_} or defined $args->{$_ . '-lt'} or defined $args->{$_ . '-gt'}) {

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Help: Extended search form? In reply to
You've meant search.cgi (Line 48 - v2.04), right?

Works but doesn't solve my problems ...

If i try to use:

search.cgi?ZIP-gt=90000&ZIP-lt=99999&Country=Hungary

it shows the correct results ... but if i use:

search.cgi?ZIP-gt=10000&ZIP-lt=19999&Country=Hungary

it shows me also a record what does have the value 98765 in the zip field ... is this shown cause it also has the value Hungary in the country-field?

Is it possible to use the search with two independent criterions?

I need to check the field country and the field ZIP ... an entry should be only shown as search result from links if the country is the right one and the ZIP is in the (as term) used range ...

Quote Reply
Re: Help: Extended search form? In reply to
Hi,

You need to change the type of Zip to INT, or pad the zips with leading 0's so it sorts correctly (this is internal to mysql, not something Links SQL handles).

Cheers,

Alex

--
Gossamer Threads Inc.