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

Search Problems

Quote Reply
Search Problems
I'm having problems with search.cgi
All searches end up as "or" rather than "and"
Any help?
Quote Reply
Re: Search Problems In reply to
You need to set your templates to pass in the 'bool' parameter as either 'and' or 'or'.

You can set it as a user-selectable parameter, or as a hidden field to set it to default only to one or the other.

You can also edit the line in search.cgi:

($in->param('bool') =~ /^(and|or)$/i) ? ($bool = uc $1) : ($bool = 'AND');

This line sets the 'bool' paramter to uppercase of whatever the bool paramter is, or to default to AND if no paramter is passed.

You must be passing an 'or' to the search.cgi in your templates.








Quote Reply
Re: Search Problems In reply to
Search.cgi is ($in->param('bool') =~ /^(and|or)$/i) ? ($bool = uc $1) : ($bool = 'AND');, same result

------------------
www.serveyou.com
Quote Reply
Re: Search Problems In reply to
If you only want:

($in->param('bool') =~ /^(and|or)$/i) ? ($bool = uc $1) : ($bool = 'AND');

make it:

$bool = 'AND';

This will force the boolean to be 'AND' and eliminate the 'OR' possiblity. You should really edit you templates and fix your search submit. It will allow you to keep 'AND' or 'OR' flexibility.








[This message has been edited by pugdog (edited April 25, 2000).]
Quote Reply
Re: Search Problems In reply to
I tried that code, it aborted due to compilation errors, nothing I try works to force AND
Quote Reply
Re: Search Problems In reply to
sorry:

$bool = 'AND';

I cut/pasted the wrong buffer.

Quote Reply
Re: Search Problems In reply to
I tried that, calling the cgi girectly, it still came up or!
I'm calling http://www.serveyou.com/cgi-bin/links/modsearch.cgi?query=murrieta+carpet

(modsearch is the search.cgi I'm playing with)

------------------
www.serveyou.com
Quote Reply
Re: Search Problems In reply to
Ok,

Looking at the DBSQL.pm code, I see:

($opt_r->{'ma'})

I can't explain this one, but edit the two lines in search.cgi:

$cat_hits = $catdb->query ( { query => $query, mh => $mh, nh => $nh } );

and

$link_hits = $linkdb->query ( { query => $query, mh => $mh, nh => $nh, filter => \%filter, ww => $ww } );


you need to add an

ma => $bool,

to the list of passed parameters.

But, I started to play with it, and got some really funny results.

I even set $bool='AND' right before the queries were sent, and it didn't work.

I'm going to have to pass this to Alex.

What 'appears' to work, isn't. I thought it was working, but my searches may have been flawed... I can't even seem to force an 'AND' search even editing DBSQL.pm.

Quote Reply
Re: Search Problems In reply to
Hi-

I also have the same problem with regard to search.cgi always returning in the "OR" mode. This happens even when the boolean "AND" is included either as a user-defined, or hidden field ("bool" = "AND")on the search form.

So if you type in the search term "Art Schools" you will still get anything with "Art" or anything with "Schools", rather than just those that have both terms "Art" and "Schools" in them.

I haven't changed anything on search.cgi which has the following:

# Get/Set the search options.

($in->param('mh') =~ /^(10|25|50|100)$/) ? ($mh = $1) :($mh = 25);

($in->param('bool') =~ /^(and|or)$/i) ? ($bool = uc $1) : ($bool = 'AND');

($in->param('nh') =~ /^(\d+)$/)? ($nh = $1) : ($nh = 1);

($in->param('substring'))? ($ww = 0) : ($ww = 1);

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

Does anyone know of a way to solve this? Any help would be greatly appreciated.

-JWM


Quote Reply
Re: Search Problems In reply to
I haven't found a fix. I played with it for awhile.

Hopefully it will be fixed in the next release. I never noticed that before, which is odd.... but it did get a little frustrating once I saw it, and couldn't figure out a way around it.

http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/