Gossamer Forum
Home : Products : Links 2.0 : Customization :

search link example wanted

Quote Reply
search link example wanted
Hello,

So what is the code for linking or querying from the command line, to search a specific field, and not a query based on a search term.

In other words the search with a query is:
/server/cgi-bin/search.cgi?query=whatever
which will return matching results for whatever.

But instead I want to search by one of the fields, say by Username and the records belonging to that username:
/server/cgi-bin/search.cgi?WHATGOESHERE
which should return results for that user - how to do?

By the way, this is for searching a links database from an external site to lookup records belonging to the user when someone clicks on the link.

Thanks
Quote Reply
Re: search link example wanted In reply to
Unfortunately, the search.cgi file would have to be hacked a lot to delete the query argument in the query string.

An example of searching other fields is the following:

Templates

Code:
search.cgi?query=&Username=<%UserName%>

Non-Templates

Code:
search.cgi?query=&Username=$rec{'Username'}

The better approach may be to use DBMAN to search this other database, which does not require the keyword field. And you can search by specific fields.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


[This message has been edited by AnthroRules (edited April 05, 2000).]
Quote Reply
Re: search link example wanted In reply to
Thanks, Eliot. I will try that. But if this code

search.cgi?query=&Username=<%UserName%>

works, then there is no need to modify the search.cgi (I guess) becuase searching by username is an option. I also want users to be able to search by any search term.

Basically, it is to say that if I want to pull out all the resources submitted by Eliot in the Gossamer resource center and want to link to it from another page, it should be able to pull only resources submitted by you by looking for your userid.
Quote Reply
Re: search link example wanted In reply to
It won't work...since you need to enter words in the query argument of the query string in order for the search.cgi script to work properly.

I understand what you are looking for...and DBMAN may be better the engine to do this.

Wink

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.
Quote Reply
Re: search link example wanted In reply to
Take a look at my range search mod, particularly the changes to the first couple lines of search.cgi... this will get you what you want.

------------------
The Immuatable Order of Modding
-=-=-=-=-=-=-=-
1. Read the FAQ, 2. Search the board, 2a. Search the board again, 3. ask the question, 4. back-up, 5. experiment, 6. rephrase question (or better yet, post solution to original question)

Quote Reply
Re: search link example wanted In reply to
Hi Eliot,

Thanks again. I already have a links database that I need to query and hence DBMan will not work, though it may be a better solution.

Oldmoney,

Thanks for your suggesion. I installed your mod and also posted a problem (in your old thread) as to why it is causing an error.

Once I install this mod how do I search from the command line or from an embedded text link in a document? Can you give me an example for the following?

I want to search on the UserName field to find records belonging to that person so would it be?

search.cgi?UserName=anyone

Thanks
Quote Reply
Re: search link example wanted In reply to
 
Quote:
Thanks again. I already have a links database that I need to query and hence DBMan will not work, though it may be a better solution.

Wrong...you are wrong! Frown

I, too, have a LINKS database, and guess what, buddy, I am using DBMAN to query the data and print results in alphabetical order...

Would you like to contest this idea further? Contact me privately...

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.
Quote Reply
Re: search link example wanted In reply to
Hi Eliot,

Quote:
DBMan will not work,
Well, I meant DBMan will not work "for me" and I thought you are refering to a new installation of DBMan, for what I want to do. Basically, I have two links databases and I am trying connect one with the other however not vice versa. So, I was thinking I do not want a whole new DBMan.

No, sir I don't want to contest you, but I would greatly appreciate your assistance if you could tell me how that is going to work. Do I have to transfer all the data to DBMan and keep another database? I have a templated based DBman modded by one of our friends here, already installed. But I have never used it.

Thanks
Quote Reply
Re: search link example wanted In reply to
No, you do not move the DBMAN files. All you have to do is copy your db.cgi script and re-name it to another name. Then in this new file, add the Required Library section found in your other .cgi LINKS scripts, so that you require the following files:

otherdatabasename.def
links.cfg

Do not require the db_utils.pl file since the subs in this file are a bit different than the similarly named subs in the db.cgi script.

Then you can also use the following query string arguments:

so
sb
re
ma
ww

etc...

Wink

To see an example of how I have used the DBMAN script with my LINKS database, go here:

Code:
http://vlib.anthrotech.com/bin/showrec.cgi?db=links&Title=%5EQ&re=on&vr=1&sb=1&so=ascend&mh=25

Then you can use the following query string in your LINKS template file:

Code:
db.cgi?db=otherdatabasename&uid=default&Username=<%Username%>&sb=1&so=ascend&view_records=1

Replace otherdatabasename with the name of your other database file.
Regards,

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


[This message has been edited by AnthroRules (edited April 06, 2000).]
Quote Reply
Re: search link example wanted In reply to
Hi Eliot,

Thanks for your reply but am having problems.
It gives me an error saying

Quote:
Reason: Can't locate otherdatabase.cfg in @INC

Here is what I did.

1. copied the require statements from my links .cgi in db.cgi renamed it as db2.cgi

Now I am not sure if I should load in the a. existing dbman directory or
b. my links database admin directory
c. my links cgi-bin direcroty

Where should it go? I tried a. and c.

Thank you.

Quote Reply
Re: search link example wanted In reply to
Don't necessarily want to wade into this fray, since you are already implementing a different solution (which I may add is also very elegant-- Eliot has probably got the most integration of Links and DBman that I've seen). But, assuming you have defined your primary search fields as such
Code:
($in{'query'} or $in{'Category'} or $in{'UserName'}) or &site_html_search_form and return;

the hard link would look like this
Code:
/cgi-bin/search.cgi?Category=&UserName=Somebody&query=&type=keyword&mh=10&bool=and

And thanks for catching the typo in the posted mod...

------------------
The Immuatable Order of Modding
-=-=-=-=-=-=-=-
1. Read the FAQ, 2. Search the board, 2a. Search the board again, 3. ask the question, 4. back-up, 5. experiment, 6. rephrase question (or better yet, post solution to original question)



[This message has been edited by oldmoney (edited April 07, 2000).]
Quote Reply
Re: search link example wanted In reply to
Oldmoney,

Thanks a lot. Your soultion is working for me.

Eliot,

When you have some time may be you can let me know what I am doing wrong with regrads to your DBMan solution. I am curious to implement that if I can. I will try it from scratch again and see if I did something wrong.

Thanks
Quote Reply
Re: search link example wanted In reply to
Great. Any solution that works is a good solution...

------------------
The Immuatable Order of Modding
-=-=-=-=-=-=-=-
1. Read the FAQ, 2. Search the board, 2a. Search the board again, 3. ask the question, 4. back-up, 5. experiment, 6. rephrase question (or better yet, post solution to original question)

Quote Reply
Re: search link example wanted In reply to
socrates...

I sent you an email message three days ago about your problem. Since I did not hear from you...I am assuming that you are going to do it on your own...

Good luck...I do not have time, patience, nor motivation to go through the step-by-step instructions on what I did.

Sorry.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.
Quote Reply
Re: search link example wanted In reply to
Hi Eliot,

Sorry, I do not use that email regularly. I check that mailbox once every two weeks. I sent you an email (reply) just now.

Thank you.