Gossamer Forum
Home : Products : Links 2.0 : Customization :

Researching with boolean 'or'

Quote Reply
Researching with boolean 'or'
I am interested in reworking the search.cgi to re-search for results with the boolean 'or' if no results are found in the default 'and' search. I would like this to be transparent to the users.

Does anyone have a suggestion on the best way to implement this? Right now, if there are no results, I have the search box on the no results page set to search with 'or' but the user has to decide he wants to try again and re-enter the search term. I would set all the defaults to 'or' but it becomes pointless for some searches when several thousand results are listed! Wink

Thanks.

------------------
Kevin D
greeknet.hypermart.net
webmaster@greeknet.hypermart.net

Quote Reply
Re: Researching with boolean 'or' In reply to
I dont know if there is another good methods.
For myself, i changed the line
&site_html_search_failure ("no matching records");
to
print"Location: /cgi-bin/search/search.pl?query=$term","\n\n";
The script automatically send the user to search altavista results when there is no matching record and it works fine.
Change it to :
path/search.cgi?query=$term&bool=or
so that it can serach for "or" when there is no matching record.
Quote Reply
Re: Researching with boolean 'or' In reply to
I too have it set up that a user can search a different service.

What I would really like is to have the script say (to itself):

Ok, I didn't find any results for "blue cows in ohio", let me check for "blue" or "cows" or "in" or"ohio" and return those results.

I think I need to add a routine to search.cgi where :
# Return unless we have results.
((keys %link_results > 0) or ($#category_results >= 0)) or
&site_html_search_failure ("no matching records") and return;

HELP!

------------------
Kevin D
greeknet.hypermart.net
webmaster@greeknet.hypermart.net

Quote Reply
Re: Researching with boolean 'or' In reply to
OK, I've played around with this and I'm hoping this will make a light bulb go off for someone.

It seems what needs to be done is to create a new subroutine within the script where (if the search finds no matches) the search re-starts with the boolean set to "or".

>>Now, if I could just write that snippet!<<
Smile

------------------
Kevin D
greeknet.hypermart.net
webmaster@greeknet.hypermart.net