I was curious as to how you would go about setting up a search for multiple keywords even if the keywords are not in the order as they were originally stored. Say it has "free home" as some of the keywords. When I do a search for home free it shows No Matching Records. Any help would be appreciated.
Aug 18, 1999, 6:33 PM
Veteran / Moderator (8669 posts)
Aug 18, 1999, 6:33 PM
Post #2 of 19
Views: 4629
You can set the script up to do "or" searches, if you want. I don't know how to do "and" searches.
To do "or" searches:
First -- the easy way
Enter your search terms like
home|free
and check the Reg. Expr. box in the search options section.
---------------------------------
Second -- the more complicated way
In db.cgi, sub query, add the following code after
local ($sortby);
$in{'keyword'} =~ s/ /|/g;
$in{'re'} = 1;
}
Enter your keywords like
home free
Downside -- you will no longer be able to search for phrases
-----------------------------------
Third -- a little more complicated
In db.cgi, sub query, add the following code after
local ($sortby);
$in{'keyword'} =~ s/ or /|/g;
$in{'re'} = 1;
}
Enter your keywords like
home or free
This allows you to still search for phrases.
------------------
JPD
To do "or" searches:
First -- the easy way
Enter your search terms like
home|free
and check the Reg. Expr. box in the search options section.
---------------------------------
Second -- the more complicated way
In db.cgi, sub query, add the following code after
local ($sortby);
Code:
if ($in{'keyword'} =~ / /) { $in{'keyword'} =~ s/ /|/g;
$in{'re'} = 1;
}
Enter your keywords like
home free
Downside -- you will no longer be able to search for phrases
-----------------------------------
Third -- a little more complicated
In db.cgi, sub query, add the following code after
local ($sortby);
Code:
if ($in{'keyword'} =~ / or /) { $in{'keyword'} =~ s/ or /|/g;
$in{'re'} = 1;
}
Enter your keywords like
home or free
This allows you to still search for phrases.
------------------
JPD
Aug 18, 1999, 7:13 PM
Novice (11 posts)
Aug 18, 1999, 7:13 PM
Post #5 of 19
Views: 4646
OK, I have a form set up from the main page that performs a site search. I have a drop-down box that selects the Category to search in. There is a regular input box where the keywords are typed in. So it searches for keywords in a particular field. Here is the code: <form action="cgi-bin/dbman/db.cgi" method="GET">
<input type=hidden name="uid" value="default">
<input type=hidden name="db" value="site">
<input type=hidden name="view_records" value="1">
<center><input type="text" name="Keys" size="12">
</center><br>
<font face="verdana" size="0" color="#FFFFFF"><strong>Search within:<br>
<INPUT TYPE="radio" NAME=Category VALUE="Tutorials">Tutorials<br>
<INPUT TYPE="radio" NAME=Category VALUE="Other">General</strong></font><P>
<center><INPUT TYPE="SUBMIT" NAME="view_records" VALUE="Search"></center></FORM>
[This message has been edited by brock91 (edited August 18, 1999).]
<input type=hidden name="uid" value="default">
<input type=hidden name="db" value="site">
<input type=hidden name="view_records" value="1">
<center><input type="text" name="Keys" size="12">
</center><br>
<font face="verdana" size="0" color="#FFFFFF"><strong>Search within:<br>
<INPUT TYPE="radio" NAME=Category VALUE="Tutorials">Tutorials<br>
<INPUT TYPE="radio" NAME=Category VALUE="Other">General</strong></font><P>
<center><INPUT TYPE="SUBMIT" NAME="view_records" VALUE="Search"></center></FORM>
[This message has been edited by brock91 (edited August 18, 1999).]
Aug 18, 1999, 7:29 PM
Novice (11 posts)
Aug 18, 1999, 7:29 PM
Post #7 of 19
Views: 4638
Sorry, I know you must be getting sick of me. I tried substituting Keys for keywords and I still get no results. Now if I type them in order as they were saved it works fine, but how many poeple do you know will type things like that. Most of the pages that are stored have up to 30 different keywords. There is alot of information on all those pages so the keywords can't really be knocked down any. This makes it easy to categorize but dificult to search for.
Aug 18, 1999, 7:48 PM
Veteran / Moderator (8669 posts)
Aug 18, 1999, 7:48 PM
Post #8 of 19
Views: 4640
I should have had you do this in the first place.
Take out the code that I gave you.
Type in your search terms with a | between them.
If you have the search options, select "Reg. Expression." If you don't, after you get the "No Matching Records" page, go up into the Location window in your browser and enter
&re=1
in the URL there. The hit your "Enter" key to do the search again.
If you still get "No Matching Records," I don't know how to help you. The only thing I know to do is to use a regular expression.
------------------
JPD
Take out the code that I gave you.
Type in your search terms with a | between them.
If you have the search options, select "Reg. Expression." If you don't, after you get the "No Matching Records" page, go up into the Location window in your browser and enter
&re=1
in the URL there. The hit your "Enter" key to do the search again.
If you still get "No Matching Records," I don't know how to help you. The only thing I know to do is to use a regular expression.
------------------
JPD
Aug 18, 1999, 8:00 PM
Novice (11 posts)
Aug 18, 1999, 8:00 PM
Post #9 of 19
Views: 4607
It works for OR searches. That is cool. It really doesn't help with more than one keyword. If you come up with a way please feel free to email me. It has got me stumped pretty bad. Is there any way to make it maybe just ignore everything but the first keyword. Basically so it doesn't pop up to that No Matching Records page.
Aug 18, 1999, 8:53 PM
Veteran / Moderator (8669 posts)
Aug 18, 1999, 8:53 PM
Post #10 of 19
Views: 4653
brock91....One thought is that you could use another database driven program, such as LINKS2, that has "And" and "Or" Connectors/Boolean type options. When I looked at your site...it struck me that you could use something like LINKS2. Not to dissuade you from using DBMAN (it is a great product and I use both LINKS and DBMAN for various web projects); but you can customize LINKS to do exactly what you are looking for.
Regards,
------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Regards,
------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Aug 19, 1999, 9:11 AM
Novice (11 posts)
Aug 19, 1999, 9:11 AM
Post #12 of 19
Views: 4609
OK. Let's say that several pages haves the keyword "cake" on them. For arguments sake we'll say three of them. Now on the first page there is also a keyword "chocolate", on the second "angel", and on the third "white".
Now there is also a bunch of other files, but these 3 are the only ones with "cake" being a keyword. What I want is to be able to search for "chocolate cake" and have it display only the page with "chocolate cake" as a keyword. Now if it's entered into the keywords when you first make the entry as "chocolate cake" it will find the page, but if you were to put in "cake chocolate" it will return No Matching Records. That is what I want to fix. Understand? Sorry for making this all so dificult.
Now there is also a bunch of other files, but these 3 are the only ones with "cake" being a keyword. What I want is to be able to search for "chocolate cake" and have it display only the page with "chocolate cake" as a keyword. Now if it's entered into the keywords when you first make the entry as "chocolate cake" it will find the page, but if you were to put in "cake chocolate" it will return No Matching Records. That is what I want to fix. Understand? Sorry for making this all so dificult.
Aug 19, 1999, 9:45 AM
Veteran / Moderator (8669 posts)
Aug 19, 1999, 9:45 AM
Post #13 of 19
Views: 4664
May 7, 2000, 8:29 PM
Veteran / Moderator (8669 posts)
May 7, 2000, 8:29 PM
Post #15 of 19
Views: 4614
May 9, 2000, 4:31 AM
Novice (17 posts)
May 9, 2000, 4:31 AM
Post #18 of 19
Views: 4634
Never mind, it can't work anyway, what i'm actually trying to do is to make a search with multiple checkboxes.
So for example:
In the demo-database i want a search-form with 5 checkboxes for the Type and 5 checkboxes for the Category-field.
Now if i search on type: Gopher and FTP
category: General
Iwant to see the records that have
- type: Gopher category: General
- type: FTP category: General
nothing else
Thijs Goos
[This message has been edited by Thijs Goos (edited May 09, 2000).]
So for example:
In the demo-database i want a search-form with 5 checkboxes for the Type and 5 checkboxes for the Category-field.
Now if i search on type: Gopher and FTP
category: General
Iwant to see the records that have
- type: Gopher category: General
- type: FTP category: General
nothing else
Thijs Goos
[This message has been edited by Thijs Goos (edited May 09, 2000).]