View Full Version : How to search for numerical keywords?
jcmx
Jul-13-2006, 01:08 PM
I take photos at sports events (in my case, motocross) and embed the
numbers of the competitors as specific keywords in the IPTC headers.
SM parses these correctly, I see the numerical keywords for each photo.
However I can't search for the photos by numerical keyword. The problem
is doubly frustrating in that searching for a small number (like "5") doesn't
work at all because the "search string is too short" - arrrgh.
If I only have a few numbers, it's not a huge deal because the top 100
keywords will show the numbers. But after I have hundreds of numbers in
the system it doesn't scale.
I tag each photo with keywords for bike brand and number (for example,
"honda" and "38"). I'd like to let my users just enter "honda 38" in the
search box and just get photos matching both. But that doesn't work (it
returns all photos matching "honda" and "38" is ignored).
Help?
Andy
Jul-13-2006, 01:44 PM
Hi, thanks for posting!
Please see my pro tips thread
http://www.dgrin.com/showthread.php?t=20236
http://www.dgrin.com/showpost.php?p=201560&postcount=28
http://www.koalaplayhouse.com/gallery/906894
jcmx
Jul-13-2006, 02:48 PM
Hi, thanks for posting!
Please see my pro tips thread
http://www.dgrin.com/showthread.php?t=20236
http://www.dgrin.com/showpost.php?p=201560&postcount=28
http://www.koalaplayhouse.com/gallery/906894
Figured out a better way, using javascript and the /keyword/<key>-<key>-<key>... url syntax. See:
http://jcmx.smugmug.com
For those who might have a tough time deciphering which JS I added, here
it is:
<!--
function doTheSearch()
{
var n = document.bikesearch.number.value;
var b = document.bikesearch.brand.options[document.bikesearch.brand.selectedIndex].value;
if ( n=="" && b=="" ) {
return;
}
var newUrl = "/keyword/";
if ( n!="" && b!="" ) {
newUrl += n + "-" + b;
}
else if ( n=="" ) {
newUrl += b;
}
else {
newUrl += n;
}
window.location = newUrl;
}
// -->
and the appropriate HTML (tables are for nice formatting):
<table border=1><tr><td>
<form name="bikesearch" action="">
<table border=0><tr><td valign=middle>
<font color=white size=-1 face=arial>Enter your bike number: </td><td valign=middle><input name=number size=3> </td><td valign=middle><font color=white size=-1 face=arial>Brand: <select name=brand>
<option value="">
<option value="honda">Honda
<option value="yamaha">Yamaha
<option value="kawasaki">Kawasaki
<option value="suzuki">Suzuki
<option value="ktm">KTM
<option value="cobra">Cobra
<option value="polini">Polini
<option value="lem">LEM
</select> </td>
<td valign=middle><input type="button" name=search value="Search" onClick="doTheSearch()"></td></tr></table>
</td></tr></table></form>
Thanks,
John
Andy
Jul-13-2006, 02:51 PM
Figured out a better way, using javascript and the /keyword/<key>-<key>-<key>... url syntax. See:
http://jcmx.smugmug.com
For those who might have a tough time deciphering which JS I added, here
it is:
<!--
function doTheSearch()
{
var n = document.bikesearch.number.value;
var b = document.bikesearch.brand.options[document.bikesearch.brand.selectedIndex].value;
if ( n=="" && b=="" ) {
return;
}
var newUrl = "/keyword/";
if ( n!="" && b!="" ) {
newUrl += n + "-" + b;
}
else if ( n=="" ) {
newUrl += b;
}
else {
newUrl += n;
}
window.location = newUrl;
}
// -->
and the appropriate HTML (tables are for nice formatting):
<table border=1><tr><td>
<form name="bikesearch" action="">
<table border=0><tr><td valign=middle>
<font color=white size=-1 face=arial>Enter your bike number: </td><td valign=middle><input name=number size=3> </td><td valign=middle><font color=white size=-1 face=arial>Brand: <select name=brand>
<option value="">
<option value="honda">Honda
<option value="yamaha">Yamaha
<option value="kawasaki">Kawasaki
<option value="suzuki">Suzuki
<option value="ktm">KTM
<option value="cobra">Cobra
<option value="polini">Polini
<option value="lem">LEM
</select> </td>
<td valign=middle><input type="button" name=search value="Search" onClick="doTheSearch()"></td></tr></table>
</td></tr></table></form>
Thanks,
John
Awesome :thumb
Can we have a gallery link where this is being used? I'd love to see it in action!
jcmx
Jul-13-2006, 03:01 PM
Awesome :thumb
Can we have a gallery link where this is being used? I'd love to see it in action!
Right now I've got it at the top of http://jcmx.smugmug.com. I'll be
working that sort of thing in more as I get it ramped up (have lots of photos
to move over from my old site).
Andy
Jul-13-2006, 03:05 PM
Awesome. I've cross linked to my pro tips thread:
http://www.dgrin.com/showthread.php?p=343358#post343358
:thumb
pat.kane
Jul-15-2006, 09:36 PM
Thanks for sharing.
I just tried the html from within a gallery description and it works like a charm.
I could see using this for my baseball/volleyball pictures (player/game instead of brand/number).
TristanP
Jul-19-2006, 07:36 AM
How would I get the javascript to work with three variables rather than two? I'd like to able to have the racers search by number, status (Expert vs Novice), and series (WERA, CCS, other). I have the html working for the drop-downs, but don't have a clue for the js. Thanks.
TristanP
Jul-20-2006, 07:18 PM
No ideas from anyone?
jcmx
Aug-02-2006, 08:11 AM
No ideas from anyone?
Sorry, was out for quite a while. It should be pretty simple.
Post your html for the drop-downs and I'll respond with a mod.
John
TristanP
Aug-03-2006, 06:25 AM
Thanks for getting back to me John. Right now, I've implemented your awesome search function for just two fields and as far as I can tell, it works flawlessly. I'd just like to be able to add one more field (Expert/Novice). I don't have the html right here with me, but I can post it later. If you have some basic framework for the script, it should be an easy plug-in to the other existing code, right? You can see the search in action here (http://www.tristansphotography.com).
TristanP
Aug-07-2006, 08:46 PM
Here's the code I'm currently working on:
<table border=1>
<tr>
<td>
<form name="carsearch" action="">
<table border=0 cellpadding=2>
<tr>
<td valign=middle>
Class:
<select name=class>
<option value="">
<option value="SA">SA
<option value="SF">SF
<option value="SR">SR
<option value="MA">MA
<option value="MR">MR
<option value="UA">UA
<option value="UR">UR
</select>
</td>
<td valign=middle>
Make:
<select name=make>
<option value="">
<option value="Acura">Acura
<option value="Audi">Audi
<option value="BMW">BMW
<option value="Chevy">Chevy
<option value="Ford">Ford
<option value="Honda">Honda
<option value="Mitsubishi">Mitsubishi
<option value="Mazda">Mazda
<option value="Nissan">Nissan
<option value="Porsche">Porsche
<option value="Subaru">Subaru
<option value="Toyota">Toyota
</select>
</td>
<td valign=middle>
Color:
<select name=color>
<option value="">
<option value="Black">Black
<option value="Blue">Blue
<option value="Gray">Gray
<option value="Orange">Orange
<option value="Red">Red
<option value="Silver">Silver
<option value="Yellow">Yellow
<option value="White">White
</select>
</td>
<td>
<input type="button" name=search value="Search" onClick="doTheSearch()">
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
sbressler
Oct-31-2007, 03:23 AM
Is there a way for the search box to work when pressing the Enter key rather than hitting search? When pressing the Enter key of course the form looks at the action, which is blank, and it redirects me to the page with ?bike=blahblah&brand=blahblah added to the end of the url.
I've implemented the search on my site (http://gallery.lsb-photo.com/gallery/3538078), but the same behavior happens. I tried added onSubmit to the form, but that didn't accomplish anything...
lindsaytblum
Oct-02-2009, 11:21 AM
Hi. I'm trying to implement this on my site. I've deciphered the html, but the javascript is killing me. How would I mod the JS to search for a 4 digit number value (up to 4 digits, for race numbers).
Thank you:dunno
dlonskey
Nov-04-2009, 08:29 PM
First off, I'd like to thank JCMX for the coding he supplies and the guys at SmugMug that have been helping me via email...THANKS :clap:thumb . I've entered in the coding but was wondering if there was a way to have this "bike seach" only shown on my gallery "homepage" and any of my motorsports pages? I have pictures of scenery, animals, ect and it looks a little "funny" having a "bike search" option on those pages. I like the search option that is already available and would like to keep it. The only other option try and have this option on here twice but have it geared towards my other pictures.
dlonskey
Nov-05-2009, 06:12 PM
Hi. I'm trying to implement this on my site. I've deciphered the html, but the javascript is killing me. How would I mod the JS to search for a 4 digit number value (up to 4 digits, for race numbers).
Thank you:dunno
Hello. I too installed the java script from JCMX on my gallery for my bike pictures. From what I can see, it should work for 4-digit numbers without making any changes. I tried it before making what I thought would be the change in the script (where is says "input name=number size=3>" I tried changing the number to 4) and it still worked so I think it will work just fine like it originally is.
dlonskey
Nov-17-2009, 05:37 PM
I'm having trouble with my single and double digit number keywords that I'm putting on my photos. I'm seeing that, on my homepage, all my single & double digit keywords ar enot showing. I'm also seeing that they are not showing up in the galleries. When I go back to the SmugMug program to add them in, I see that they are there. I understand the SmugMug search program right now doesn't allow for single and double digit searches on keywords. I'm using the java script from JCMX, which was working great. I know it's not his java script because of the issue I'm seeing with my homepage keyword section not listing any single & double digit keywords (at one time I saw some single & double digits but not all, then all of a sudden they were all gone). I take LOTS of pictures and have spent LOTS of time and energy in getting my pictures keyworded with these numbers so riders can find themselve quickly. Don't know if this wil work, but here is a link to one of my galleries that has single & double digit keywords. If you look at the picture of these riders, the keyword doesn't appear (which explains why it doesn't show on my homepage), but if you "edit" the keyword or go into the SmugMug program to add keywords, you will see them there. If you can't see this and there is a regular email address I can use, I'd be more then happy to try and send a screen shot of what I'm talking about.
devbobo
Nov-17-2009, 07:12 PM
if you could show me some examples on your site it would be useful, but i think if you insert the modified code below, it should work for you...
<!--
function doTheSearch()
{
var n = document.bikesearch.number.value;
var b = document.bikesearch.brand.options[document.bikesearch.brand.selectedIndex].value;
if ( n=="" && b=="" ) {
return;
}
var newUrl = "/keyword/";
if ( n!="" && b!="" ) {
newUrl += n + "/" + b;
}
else if ( n=="" ) {
newUrl += b;
}
else {
newUrl += n;
}
window.location = newUrl;
}
// -->
Cheers,
David
juan14888
Nov-18-2009, 04:27 PM
Thanks for getting back to me John. Right now, I've implemented your awesome search function for just two fields and as far as I can tell, it works flawlessly. I'd just like to be able to add one more field (Expert/Novice). I don't have the html right here with me, but I can post it later. If you have some basic framework for the script, it should be an easy plug-in to the other existing code, right? You can see the search in action here (http://www.tristansphotography.com).
Tristan,
Your site looks great, I looking to do a search box like what you've done, but only in one gallery, "Events" what I envision would be that when the Events gallery is picked then the search box would be displayed, with the option to also view all photos, Any ideas?
dlonskey
Nov-18-2009, 07:48 PM
if you could show me some examples on your site it would be useful, but i think if you insert the modified code below, it should work for you...
<!--
function doTheSearch()
{
var n = document.bikesearch.number.value;
var b = document.bikesearch.brand.options[document.bikesearch.brand.selectedIndex].value;
if ( n=="" && b=="" ) {
return;
}
var newUrl = "/keyword/";
if ( n!="" && b!="" ) {
newUrl += n + "/" + b;
}
else if ( n=="" ) {
newUrl += b;
}
else {
newUrl += n;
}
window.location = newUrl;
}
// -->
Cheers,
David
David...I'm thinking it has nothing to do with the java script because they are missing from the actual keyword section on my homepage and are "missing" from the photos as well (however, they do show up when I go back into the smugmug program for adding keywords). I'm trying to figure out how I can get screen shots made into JPEGS so I can post them for you and others to see so you know what I'm talking about.
dlonskey
Nov-18-2009, 08:08 PM
if you could show me some examples on your site it would be useful, but i think if you insert the modified code below, it should work for you...
<!--
function doTheSearch()
{
var n = document.bikesearch.number.value;
var b = document.bikesearch.brand.options[document.bikesearch.brand.selectedIndex].value;
if ( n=="" && b=="" ) {
return;
}
var newUrl = "/keyword/";
if ( n!="" && b!="" ) {
newUrl += n + "/" + b;
}
else if ( n=="" ) {
newUrl += b;
}
else {
newUrl += n;
}
window.location = newUrl;
}
// -->
Cheers,
David
David...try these. I've attached 3 PDFs that hopefully you can open: "homepage" pdf is what is shown on my SmuMug homepage, "gallery_62 missing" pdf is what it looks like looking at one of my pictures in it's gallery, "gallery_62 listed" pdf is what you see when you click on the "edit" button to edit the keywords (hopefully the attachments posted :dunno )
juan14888
Aug-25-2010, 01:02 PM
David...I'm thinking it has nothing to do with the java script because they are missing from the actual keyword section on my homepage and are "missing" from the photos as well (however, they do show up when I go back into the smugmug program for adding keywords). I'm trying to figure out how I can get screen shots made into JPEGS so I can post them for you and others to see so you know what I'm talking about.
Figured out a better way, using javascript and the /keyword/<key>-<key>-<key>... url syntax. See:
http://jcmx.smugmug.com
For those who might have a tough time deciphering which JS I added, here
it is:
<!--
function doTheSearch()
{
var n = document.bikesearch.number.value;
var b = document.bikesearch.brand.options[document.bikesearch.brand.selectedIndex].value;
if ( n=="" && b=="" ) {
return;
}
var newUrl = "/keyword/";
if ( n!="" && b!="" ) {
newUrl += n + "-" + b;
}
else if ( n=="" ) {
newUrl += b;
}
else {
newUrl += n;
}
window.location = newUrl;
}
// -->
and the appropriate HTML (tables are for nice formatting):
<table border=1><tr><td>
<form name="bikesearch" action="">
<table border=0><tr><td valign=middle>
<font color=white size=-1 face=arial>Enter your bike number: </td><td valign=middle><input name=number size=3> </td><td valign=middle><font color=white size=-1 face=arial>Brand: <select name=brand>
<option value="">
<option value="honda">Honda
<option value="yamaha">Yamaha
<option value="kawasaki">Kawasaki
<option value="suzuki">Suzuki
<option value="ktm">KTM
<option value="cobra">Cobra
<option value="polini">Polini
<option value="lem">LEM
</select> </td>
<td valign=middle><input type="button" name=search value="Search" onClick="doTheSearch()"></td></tr></table>
</td></tr></table></form>
Thanks,
John
Great job, I'm looking to do a search box like this one, but to show up in only in a few selected galleries and the home page Any ideas? :scratch
Kiko
Sep-08-2010, 11:25 AM
I tag each photo with keywords for bike brand and number (for example,
"honda" and "38"). I'd like to let my users just enter "honda 38" in the
search box and just get photos matching both. But that doesn't work (it
returns all photos matching "honda" and "38" is ignored).
Help?
Just to give you an alternative solution, all the galleries under http://www.marignatios.com/Esportes allow searching using race numbers. The way we've solved it there is that each gallery has its own keyword, which we mass-add to all pictures at once. We rig the search box there with JS to concatenate the gallery keyword with the number, creating a /keyword/ URL.
For numbers with a single digit we always prefix it in the photo with 0, so there's no "5", just "05", and the search box JS prefixes the number with a zero if it's just one digit.
Question: do you add the IPTC keyword manually, or do you use some form of OCR on the picture?
Kiko
Sep-08-2010, 11:30 AM
however, they do show up when I go back into the smugmug program for adding keywords).
I think you're saying you use some third-party program to add keywords to pictures. Note that SM expects keywords to be under the IPTC:Keywords field: http://www.smugmug.com/help/keywords-tags -- maybe your program is adding them to some other field and they aren't getting recognized. You can tell by looking at the picture in the gallery -- when SM recognizes the keywords they are listed under the picture.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.