Gossamer Forum
Home : Products : Links 2.0 : Customization :

Wanted: mod for search on specific fields

Quote Reply
Wanted: mod for search on specific fields
For Links 2.0:

Has anyone done a mod that allows visitors to search on the fields of their choice? If so, could you let me know what you did?

If not, can someone point me in the right direction (which files need to be altered)?

Any help would be appreciated.

Best,
Kate

------------------
www.floor42.com


[This message has been edited by Kate42 (edited March 14, 1999).]
Quote Reply
Re: Wanted: mod for search on specific fields In reply to
Ok. Here are semi- step by step instructions.

Open up search.cgi

under:
# Go through the database.
open (DB, "<$db_file_name") or &cgierr("error in search. unable to open database: $db_file_name. Reason: $!");
flock (DB, 1) if ($db_use_flock);
LINE: while (<DB> ) {
/^#/ and next LINE; # Skip comment Lines.
/^\s*$/ and next LINE; # Skip blank lines.
chomp; # Remove trailing new line.
@values = &split_decode($_);
$grand_total++;

add:

if ($in{'category'}){
($in{'category'} eq $values[$db_category]) or next LINE;
}

Make the category in $in{'category'} set to the term you send in through the site_html for searches. Make the category in $db_category equal to the field in the database.

You can add as many fields as you like.

Now open site_html.pl

In sub site_html_search, add:

<select name=database_field><option>option 1<option>option 2<option>etc....</select>

Set database_field to the name you used in search.cgi for category in the statement $in{'category'}

Everything should work now.


------------------
Quote Reply
Re: Wanted: mod for search on specific fields In reply to
Alex,

Quote:
http://gossamer-threads.com/scripts/links/demo/search.cgi?Contact+Name=Alex+Krohn

You're just "too common" for words (or for results, for that matter)! Wink

[This message has been edited by Bobsie (edited March 15, 1999).]
Quote Reply
Re: Wanted: mod for search on specific fields In reply to
CEGlobe,

I wanted to get with you about this issue. Your site was posted having this feature so I visited.

Here is an example of what I had a question on:

I go to the category "H/PC Pro Software", do a search for "corporate connection" which has the path of:

/HPC_Pro/Programming/{Corporate Connection Link}

I choose "just this category". It returns with no results if it is not just the "H/PC Pro Software". If I choose "all of ceglobe", it finds it.

It would be nice if it would search deep in a category, not just that level on the chosen category. I do not think the mod would be helpful to have that option if there is no more than 20 links in that category. Any idea what to add in search.cgi to let it search deep in categories?

Thanks in advance,
elms

[This message has been edited by elms (edited March 15, 1999).]
Quote Reply
Re: Wanted: mod for search on specific fields In reply to
CE Globe -

Your instructions helped tremendously. Thank you!

-Kate

------------------
www.floor42.com
Quote Reply
Re: Wanted: mod for search on specific fields In reply to
 
Quote:
Has anyone done a mod that allows visitors to search on the fields of their choice? If so, could you let me know
what you did?

This is already in version 2! For instance, try out:

http://gossamer-threads.com/...search.cgi?isNew=Yes

to match where all new records. Or:

http://gossamer-threads.com/...tact+Name=Alex+Krohn

to match links I added. You can mix and match different fields, as well as use query=somevalue to search on the standard fields.

Cheers,

Alex
Quote Reply
Re: Wanted: mod for search on specific fields In reply to
Wow - I didn't realise that 2.0 had this feature!

Is it possible then for a search to only return hits if a certain field contains a certain vale. eg if Search=Yes -- I wish to exclude certain sites from our searching mechanism and this would be an ideal answer...

------------------
Craig Antill
10 Tenths Motorsport (1.1) - www.Ten-Tenths.com/links/
THE Directory (2.0b3) - www.gardenbuildings.com/
Quote Reply
Re: Wanted: mod for search on specific fields In reply to
Oops, Contact Name probably wasn't a good example, but you get the idea. =)

Quote:
Is it possible then for a search to only return hits if a certain field contains a certain vale. eg if Search=Yes -- I
wish to exclude certain sites from our searching mechanism and this would be an ideal answer...

Sure, add a new field called Search, and then either in the search form add a hidden tag saying Search=Yes, or to be extra safe, add $in{'Search'} = "Yes" to the beginning of search.cgi so people can't override it.

Cheers,

Alex
Quote Reply
Re: Wanted: mod for search on specific fields In reply to
Can I also make my links database search with "only in subcategory" apart from complete search using the above feature. If so PLEASE tell me exactly how to do it just the way we have it in yahoo.

Please help.
-Sam
Quote Reply
Re: Wanted: mod for search on specific fields In reply to
Alex,

GREAT! Now can I *exclude* categories (more than one) with the same type of command?



------------------
---
Robert Basil
Internet Systems
Chandler Unified School District #80

Quote Reply
Re: Wanted: mod for search on specific fields In reply to
Have you seen

http://www.gossamer-threads.com/scripts/forum/resources/Forum3/HTML/001387.html

I think that might help you.
Do you have any clue to my query above.

-San
Quote Reply
Re: Wanted: mod for search on specific fields In reply to
sam did you find an answer to your question?
Quote Reply
Re: Wanted: mod for search on specific fields In reply to
In Reply To:
You can mix and match different fields, as well as use query=somevalue to search
on the standard fields.
How do I mix fields? and say, I'd have an extra field containing only numbers, could I search on for example on all records of which this number is lower than 12 (<12)?

Lex

nospam_Lex@peng.nl
Quote Reply
Re: Wanted: mod for search on specific fields In reply to
I think that the Range Search thing, in the Resource Center, will do this.

SmileSmile

Quote Reply
Re: Wanted: mod for search on specific fields In reply to
Thanks!

But after searching the Recources, I couldn't find what you are mentioning... Any more clues as how I get there?

Thanks,

Lex

nospam_Lex@peng.nl