How to search for numerical keywords?

jcmxjcmx Beginner grinnerRegistered Users Posts: 9 Beginner grinner
edited September 8, 2010 in SmugMug Support
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?

Comments

  • AndyAndy Bicameral New YorkRegistered Users Posts: 50,154 Major grins
    edited July 13, 2006
  • jcmxjcmx Beginner grinner Registered Users Posts: 9 Beginner grinner
    edited July 13, 2006
    Figured out a new way
    Andy wrote:

    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
  • AndyAndy Bicameral New YorkRegistered Users Posts: 50,154 Major grins
    edited July 13, 2006
    jcmx wrote:
    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 <img src="https://us.v-cdn.net/6029383/emoji/thumb.gif&quot; border="0" alt="" >

    Can we have a gallery link where this is being used? I'd love to see it in action!
  • jcmxjcmx Beginner grinner Registered Users Posts: 9 Beginner grinner
    edited July 13, 2006
    Andy wrote:
    Awesome thumb.gif

    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).
  • AndyAndy Bicameral New YorkRegistered Users Posts: 50,154 Major grins
    edited July 13, 2006
    Awesome. I've cross linked to my pro tips thread:
    http://www.dgrin.com/showthread.php?p=343358#post343358

    thumb.gif
  • pat.kanepat.kane Major grins Registered Users Posts: 332 Major grins
    edited July 16, 2006
    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).
  • TristanPTristanP Major grins Registered Users Posts: 1,107 Major grins
    edited July 19, 2006
    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.
    panekfamily.smugmug.com (personal)
    tristansphotography.com (motorsports)

    Canon 20D | 10-22 | 17-85 IS | 50/1.4 | 70-300 IS | 100/2.8 macro
    Sony F717 | Hoya R72
  • TristanPTristanP Major grins Registered Users Posts: 1,107 Major grins
    edited July 20, 2006
    No ideas from anyone?
    panekfamily.smugmug.com (personal)
    tristansphotography.com (motorsports)

    Canon 20D | 10-22 | 17-85 IS | 50/1.4 | 70-300 IS | 100/2.8 macro
    Sony F717 | Hoya R72
  • jcmxjcmx Beginner grinner Registered Users Posts: 9 Beginner grinner
    edited August 2, 2006
    TristanP wrote:
    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
  • TristanPTristanP Major grins Registered Users Posts: 1,107 Major grins
    edited August 3, 2006
    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.
    panekfamily.smugmug.com (personal)
    tristansphotography.com (motorsports)

    Canon 20D | 10-22 | 17-85 IS | 50/1.4 | 70-300 IS | 100/2.8 macro
    Sony F717 | Hoya R72
  • TristanPTristanP Major grins Registered Users Posts: 1,107 Major grins
    edited August 7, 2006
    Here's the code I'm currently working on:

    Class:


    SA
    SF
    SR
    MA
    MR
    UA
    UR


    Make:


    Acura
    Audi
    BMW
    Chevy
    Ford
    Honda
    Mitsubishi
    Mazda
    Nissan
    Porsche
    Subaru
    Toyota


    Color:


    Black
    Blue
    Gray
    Orange
    Red
    Silver
    Yellow
    White



    panekfamily.smugmug.com (personal)
    tristansphotography.com (motorsports)

    Canon 20D | 10-22 | 17-85 IS | 50/1.4 | 70-300 IS | 100/2.8 macro
    Sony F717 | Hoya R72
  • sbresslersbressler Major grins Registered Users Posts: 148 Major grins
    edited October 31, 2007
    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, but the same behavior happens. I tried added onSubmit to the form, but that didn't accomplish anything...
  • lindsaytblumlindsaytblum Big grins Registered Users Posts: 68 Big grins
    edited October 2, 2009
    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 youne_nau.gif
  • dlonskeydlonskey Beginner grinner Registered Users Posts: 5 Beginner grinner
    edited November 4, 2009
    Bike number search (created by JCMX)
    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.gifthumb . 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.
  • dlonskeydlonskey Beginner grinner Registered Users Posts: 5 Beginner grinner
    edited November 5, 2009
    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 youne_nau.gif

    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.
  • dlonskeydlonskey Beginner grinner Registered Users Posts: 5 Beginner grinner
    edited November 17, 2009
    Number Keywords in Photos
    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.
  • devbobodevbobo LR whisperer Melbourne, AURegistered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited November 17, 2009
    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 Parry
    SmugMug API Developer
    My Photos
  • juan14888juan14888 Big grins Registered Users Posts: 55 Big grins
    edited November 18, 2009
    TristanP wrote:
    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.


    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?
  • dlonskeydlonskey Beginner grinner Registered Users Posts: 5 Beginner grinner
    edited November 18, 2009
    devbobo wrote:
    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.
  • dlonskeydlonskey Beginner grinner Registered Users Posts: 5 Beginner grinner
    edited November 18, 2009
    devbobo wrote:
    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 <img src="https://us.v-cdn.net/6029383/emoji/ne_nau.gif&quot; border="0" alt="" > )
  • juan14888juan14888 Big grins Registered Users Posts: 55 Big grins
    edited August 25, 2010
    Help with search box
    dlonskey wrote: »
    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.
    jcmx wrote: »
    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? headscratch.gif
  • KikoKiko way out west Registered Users Posts: 13 Big grins
    edited September 8, 2010
    jcmx wrote: »
    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?
  • KikoKiko way out west Registered Users Posts: 13 Big grins
    edited September 8, 2010
    dlonskey wrote: »
    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.
Sign In or Register to comment.