• 1st1 (unregistered)

    great stuff!

  • phuture (unregistered)

  • (cs)

    Well, that would understandably be very fast for a keyword search.

    In fact, if the list of keywords was generated on the fly from the contents of the site, this would approach being useful, and STILL be lightning fast, except that then you would have a few hundred kilobytes of Javascript array literals to download. But, that could be put in a separate Javascript file and cached so it would only be downloaded once...

    Hell, I wouldn't be suprised if Ruby On Rails has a way to do this in three or four lines of code within a few months.

  • aaron (unregistered)

    searchItems[0] = new Array
    ( "Initech Solutions :: Home",
       "index.htm",
       "The home page for Initech Solutions.",
       new Array (
         "home","initech","first","intro","introduction",
         "top","open","index","main","start")
    );

    has proberbly looped through a database table in serverside script and made the many arrays.  mabey it was a good idea when the site was new/or in testing when there were only a few products.  the search will always be instant but as the product count grows the page is going to keep taking longer and longer to load.

    that said if the client/developer is on broadband downloading the site at 50k/sec then 1000 products will only take a few seconds to load.

  • (cs)

    If I were Google, I'd be nervous of this new technology! 

     

  • aaron (unregistered) in reply to Jeff S

    isnt this what msn has been researching to compete in the search war

  • (cs)

    This isn't that uncommon. Most of the time, when you have one of those dinky little search boxes on a web page, they're running a simple javascript.

    I put one together for this site...The whole thing still hurts my mind, and I keep expecting it to show up on THIS site...anyway, I wrote a search function in javascript, that allowed the user to search content in  any of a couple hundred html pages...HARD CODED html pages, and it would return the most relevant results, based on the keywords associated with the page in the (again) hard coded Javascript search arrays.

    The whole thing could have been done as a lark with a database and any scripting language, hosted for a song, and a million times better because you could update the content without having to manually update pages. The damn thing was supposed to be for a social index, so people were added and moved and all this junk, all the time. Total nightmare.

    I tried so damn hard to convince the (neo-luddite) webdesigner to "experiment" with this "SQL" thing, but she refused utterly. Go figure.

  • (cs)

    is this the best WTF you could come up with today?

  • (cs)

    Pretty useless, but at least it's fast. I've seen worse than that (extremely slow and still pretty useless). Done right, it might even become semi-usefull.

  • eksortso (unregistered)

    This sort of thing might work well for a small intranet, if it were properly indexed. (This one hardly seems to be!) I wouldn't use something like this if I was dealing with a site that was really huge or changed often. And like quamaretto said above, it would work better if <FONT face="Courier New">searchItems</FONT> were stored in a separate file.

    There's an open-source project called Tipue that I've been using for an internal documentation site at my workplace. It does pretty much what this search engine does, except not as incompetently. Also, I wrote a custom indexing routine for it, even though the Tipue site comes with an indexing tool of its own.

    Tipue is at http://www.tipue.com/ if anyone wants something like this that actually works. 

  • (cs) in reply to Jeff S
    Jeff S:

    If I were Google, I'd be nervous of this new technology! 

     

    Google probably bought it already ... say for a mere 1 Million Dollars

  • (cs)

    This is fantastic!  The only problem that I see with this is that the person viewing the website didn't know what they should search for.  This is clearly not a WTF on the developer end, but more of user error.   Jeesshh.  :-)

  • (cs) in reply to mrsticks1982
    mrsticks1982:
    Jeff S:

    If I were Google, I'd be nervous of this new technology! 

     

    Google probably bought it already ... say for a mere 1 Million Dollars



    Not only did they buy it, they also made it work!
    Go here, and start typing into the text box.  Fantastic.

    http://www.google.com/webhp?complete=1&hl=en

    Google Suggest

  • (cs) in reply to Anonymoose

    Anonymoose:

    Not only did they buy it, they also made it work!
    Go here, and start typing into the text box.  Fantastic.

    http://www.google.com/webhp?complete=1&hl=en
    Google Suggest

    Google Suggest actually hits their servers and retrieves an XML document... Every time you type a letter. The fact that they have more servers and bandwidth than God, Allah, and Buddha combined is what accounts for the fluidness of the functionality, because the idea verges close to a WTF, really.

  • (cs) in reply to eksortso
    Anonymous:

    This sort of thing might work well for a small intranet, if it were properly indexed. (This one hardly seems to be!) I wouldn't use something like this if I was dealing with a site that was really huge or changed often. And like quamaretto said above, it would work better if <font face="Courier New">searchItems</font> were stored in a separate file.

    There's an open-source project called Tipue that I've been using for an internal documentation site at my workplace. It does pretty much what this search engine does, except not as incompetently. Also, I wrote a custom indexing routine for it, even though the Tipue site comes with an indexing tool of its own.

    Tipue is at http://www.tipue.com/ if anyone wants something like this that actually works. 



    Tipue is good 'ware, but the whole thing is staticly indexed which makes it a pain to keep current. If your hosting is good enough, you can get a script that'll do the indexing for you but if you can have a script on the site that can write to files then there has to be a better way than using a javascript search. They get bulky real quick.

  • (cs) in reply to Otto
    Otto:

    Anonymoose:

    Not only did they buy it, they also made it work!
    Go here, and start typing into the text box.  Fantastic.

    http://www.google.com/webhp?complete=1&hl=en
    Google Suggest

    Google Suggest actually hits their servers and retrieves an XML document... Every time you type a letter. The fact that they have more servers and bandwidth than God, Allah, and Buddha combined is what accounts for the fluidness of the functionality, because the idea verges close to a WTF, really.


    The source code is the real wtf. How many two-letter variables can you stuff into one file?
    http://www.google.com/ac.js
    I remember trying to puzzle out exactly what it did when it first came out, before I just got sick of translating and just reinvented it from scratch.

    I know what this wtf's problem is, it doesn't return enough pages. Everything should be indexed with every word on their pages. That way when someone searches for their main product, they get every page! Yes!
  • (cs) in reply to Satanicpuppy

    I don't understand, Satanicpuppy ... you could have preprocessed the SQL queries and the web designer wouldn't even have known about it.

  • (cs)

    Why do they need javascript at all?  Why not just print everything to the page and tell the user to press Ctrl-F??

    Sincerely,
    Sprio Agnew

  • (cs) in reply to reinpost

    This is actually a fairly useful idea, if the search actually is able to find what you want.

    This site:
    http://perldoc.perl.org/

    has a javascript search feature, and it actually finds things, since the search index covers things like every Perl function and module name.

    If the search comes back with no results, you just click one more button, and it does a Google search with your search terms, so if you are searching for something not in the index, you aren't left hanging.

    You can even download the entire website as a .tar.gz archive, and the search feature still works, since it never contacts the server!

    It's also good for offline use.

  • (cs)

    Not seeing the problem personally.  It is a simple keyword search.  Assuming that the search engine ONLY works with keywords, it hardly matters if it is client side processed or not.

    While it MIGHT be a waste of bandwidth, it is fast and efficent for searching the keywords that are registered.   If the site uses HTTP compression, the wasted bandwidth like likely negligable and is still probably smaller than the HTML file without the embeeded javascript for searching.

    We're all spoiled by Google.  Not every situation requires that you be able to search for the phrase "rabid gophers in heat" and expect to get plumbing references - sometimes a simple keyword search is enough to cover the basics.

    True, Google even provides tools for doing site specific searching, sometimes you don't want to flood people with results. (oh, the site searchs I have seen, and how useless they were when all I wanted to do was search titles...)  Write to your audience, and I'll bet the site search is a damn good fit for 99% of their visitors, esp. if the site is technical in nature.

  • (cs) in reply to Satanicpuppy

    Satanicpuppy:
    I tried so damn hard to convince the (neo-luddite) webdesigner to "experiment" with this "SQL" thing, but she refused utterly. Go figure.

    Kudos for using "Luddite" and "Webdesigner" to describe the same person.  Nice touch!

  • (cs) in reply to foxyshadis

    Saving bandwidth is a WTF?

  • (cs) in reply to foxyshadis

    Gah, that was supposed to be quoting this:

    foxyshadis:

    The source code is the real wtf. How many two-letter variables can you stuff into one file?
    http://www.google.com/ac.js
    I remember trying to puzzle out exactly what it did when it first came out, before I just got sick of translating and just reinvented it from scratch.

    I know what this wtf's problem is, it doesn't return enough pages. Everything should be indexed with every word on their pages. That way when someone searches for their main product, they get every page! Yes!

  • (cs) in reply to Xepol
    Xepol:

    (oh, the site searchs I have seen, and how useless they were when all I wanted to do was search titles...)



    That reminds me of searching MSDN for... anything. What a friggin' useless piece of crap search engine.  I almost always end up back at Google, and enter site:msdn.microsoft.com as a search term.

    Can't wait for Microsoft to try and compete with Google, on the search front!
  • eksortso (unregistered) in reply to Satanicpuppy

    Satanicpuppy:

    Tipue is good 'ware, but the whole thing is staticly indexed which makes it a pain to keep current. If your hosting is good enough, you can get a script that'll do the indexing for you but if you can have a script on the site that can write to files then there has to be a better way than using a javascript search. They get bulky real quick.

    I agree. This sort of thing works well for documentation sites that don't change very often. The Tipue site recommends using their search engine on sites that don't exceed 50 pages. The perldoc site is like that, even though Perl's documentation pages are freakin' huge.

    It would be nice to have a full-fledged search engine on my company's intranet, but it's overkill for us. Tipue works well enough for my purposes, even if the index is bulky (about 200KB, which isn't so bad over a local network).

  • (cs)

    <FONT face=Arial>Don't tell the guys at thunderstone (aka </FONT><FONT face=Arial>www.master.com</FONT><FONT face=Arial>). Webinator is looking pretty lame after this.</FONT>

  • (cs) in reply to foxyshadis
    foxyshadis:
    The source code is the real wtf. How many two-letter variables can you stuff into one file?
    http://www.google.com/ac.js
    I remember trying to puzzle out exactly what it did when it first came out, before I just got sick of translating and just reinvented it from scratch.

    I know what this wtf's problem is, it doesn't return enough pages. Everything should be indexed with every word on their pages. That way when someone searches for their main product, they get every page! Yes!

    Not a WTF at all, the file simply went through a compressor/obfuscator that removes all the whitespaces and renames variables to both reduce drastically the file size (can come in handy when you're Google and you might be serving the little javascript thing 50 millions times a day if it ever hits live servers) and make the code slightly harder to reverse engineer. Check Chris Justus' Google Suggest Dissected for an "unobfuscated" version.

  • (cs) in reply to masklinn
    masklinn:
    foxyshadis:
    The source code is the real wtf. How many two-letter variables can you stuff into one file?
    http://www.google.com/ac.js
    I remember trying to puzzle out exactly what it did when it first came out, before I just got sick of translating and just reinvented it from scratch.

    I know what this wtf's problem is, it doesn't return enough pages. Everything should be indexed with every word on their pages. That way when someone searches for their main product, they get every page! Yes!

    Not a WTF at all, the file simply went through a compressor/obfuscator that removes all the whitespaces and renames variables to both reduce drastically the file size (can come in handy when you're Google and you might be serving the little javascript thing 50 millions times a day if it ever hits live servers) and make the code slightly harder to reverse engineer. Check Chris Justus' Google Suggest Dissected for an "unobfuscated" version.

    Oh yeah, to answer your question that would be 26+26*36 = or 24336 different variables. And that's only taking in account alphanumerics, i think you can also use characters such as "_", "$", "è" or "µ" to name your variables in Javascript.

  • Anonymous (unregistered) in reply to masklinn

    Why does everyone hate on JavaScript so much here?

  • (cs) in reply to Anonymous
    Anonymous:
    Why does everyone hate on JavaScript so much here?


    I'm not sure who here does that. In web design, Javascript is the solution to a certain set of problems involving interactivity in web pages. It is also useful as a general high-level scripting and programming language, but only Mozilla and Macromedia and some hobbyists have figured this out.

    Searching large amounts of data, in the client's web browser, is not really a proper job for Javascript.

    Part of the reason that so much bad Javascript shows up on the site is because it is written by designers and other relatively uneducated peoples, and somewhat less because the knowledge base (popular books and web sites) is so rampant with misinformation, bad hacks and general crap that even good programmers would have a hard time finding best practices.


  • (cs) in reply to Anonymous

    Anonymous:
    Why does everyone hate on JavaScript so much here?

     

    Because.  It sucks more than anything's ever sucked before.

  • (cs) in reply to Anonymous
    Anonymous:
    Why does everyone hate on JavaScript so much here?

    Several possibilities...
    a) It's an extremely cheap clone of an already poor language.
    b) It grew in an unhealthy way and lacks a proper concept.
    c) It's used for things it shouldn't be used.
    d) It's used by people who shouldn't use it.
    e) Real programmers might actually be forced to use it.
  • Monday (unregistered) in reply to ammoQ

    It has it's place.

    -Form validation without reloading a age.
    -ummm....
    -ummmmmmmm.......
    -Form vali...oh wait. Crap.

    -Dynamic forms. Yes! I knew I had one more!

  • Gorm Braaarvig (unregistered) in reply to Otto

    I've done this for a year before google suggest.

    http://firmakatalogen.com/

    With a single server (bad lines, so latency could be an issue).
    Just 10M rows, though. Still, you get the results here, not only the words...

  • (cs) in reply to Gorm Braaarvig

    There is no way this is a WTF. This is a quick and nasty solution. But I like it. It's fast, it's on the client side, and it's pretty easy to maintain. Please try a little bit harder Alex.

  • Florian (unregistered) in reply to ammoQ
    ammoQ:
    Anonymous:
    Why does everyone hate on JavaScript so much here?

    Several possibilities...
    a) It's an extremely cheap clone of an already poor language.

    Common Lisp is poor in what respect, again?

    b) It grew in an unhealthy way and lacks a proper concept.

    It is one of the few languages that do in fact have a formal semantics, so it is among the healthiest languages out there (that does not imply that the implementations are healthy, too).

    c) It's used for things it shouldn't be used.


    Yes


    d) It's used by people who shouldn't use it.


    Indeed


    e) Real programmers might actually be forced to use it.


    It isn't actually that bad, it is the browsers that suck.

  • (cs) in reply to aaron
    Anonymous:
    that said if the client/developer is on broadband downloading the site at 50k/sec then 1000 products will only take a few seconds to load.


    What about the user?

    Some software companies have had the standard of their software being usable on an older system as a counter to bloat.

    Sincerely,

    Gene Wirchenko

  • (cs) in reply to Anonymoose
    Anonymoose:
    That reminds me of searching MSDN for... anything. What a friggin' useless piece of crap search engine.  I almost always end up back at Google, and enter site:msdn.microsoft.com as a search term.


    Thank you for the tip.  Searching Microsoft Websites has not been pleasant for me either.

    Can't wait for Microsoft to try and compete with Google, on the search front!


    First, they will have to find their butts with both hands.  (That unpleasantness has been really unpleasant.)

    Sincerely,

    Gene Wirchenko

  • Alf (unregistered) in reply to Otto

    Otto, thats called AJAX... google it (heh) so you can realise that the wtf here, is you thinking that ajax is a wtf....
    Welcome to 2005....

  • (cs) in reply to ItsAllGeekToMe
    ItsAllGeekToMe:

    Anonymous:
    Why does everyone hate on JavaScript so much here?

     

    Because.  It sucks more than anything's ever sucked before.


    XSLT gives it a good run for its money though. Someone needs to come up with a XSLJScript fusion language that requires constant use of eval() and dynamic:evaluate() (the xslt version) and transitions between the interpreters several layers deep. Use it to build a custom SQL-like database.

    The top faq for the site would be "in order to use our site, you must increase your browser http time-out".

    Casiotone:
    Saving bandwidth is a WTF?

    With http compression there would be almost no difference, in plain text would be about half again the size. Besides which, as stated, google has all the bandwidth in the universe and then some. I just made the point that it looks like a bizarre wtf made by someone who doesn't realize languages accept for than two letters per variable (yes, I know full well it was intentionally obfuscated).

    masklinn: Javascript is case-sensitive. ie, 52+52*62. (I leave gathering a list of all legal characters as an exercise to the reader.)
  • (cs) in reply to Alf
    Anonymous:
    Otto, thats called AJAX... google it (heh) so you can realise that the wtf here, is you thinking that ajax is a wtf....
    Welcome to 2005....


    The real magic of AJAX is that it lets people like you build a framework to hit the server with a XML request and recieve one back everytime the mouse moves.
  • robbak (unregistered) in reply to Anonymoose
    Anonymoose:
    Xepol:

    (oh, the site searchs I have seen, and how useless they were when all I wanted to do was search titles...)



    That reminds me of searching MSDN for... anything. What a friggin' useless piece of crap search engine.  I almost always end up back at Google, and enter site:msdn.microsoft.com as a search term.

    Can't wait for Microsoft to try and compete with Google, on the search front!

    Which reminds me that the local host of "Who Wants to be a Millionare" is always referring to "ninmsn search" if he gets the idea that a phone-a-friend was searching the internet. I'm waiting for someone to tell him that he'd be glad to, if he gave them 30 minutes to come up with something!
  • (cs) in reply to robbak

    I have actually been guilty of creating this kind of search engine :(

     

  • (cs) in reply to ammoQ
    ammoQ: a) It's an extremely cheap clone of an already poor language.
    Which language would that be, then?
    Anonymoose: searching MSDN for... anything. What a friggin' useless piece of crap search engine.
    That's been my consistent experience also.
  • Alf (unregistered) in reply to foxyshadis

    foxyshadis:
    Anonymous:
    Otto, thats called AJAX... google it (heh) so you can realise that the wtf here, is you thinking that ajax is a wtf....
    Welcome to 2005....


    The real magic of AJAX is that it lets people like you build a framework to hit the server with a XML request and recieve one back everytime the mouse moves.

     

    And why would i do that, i currently use Ajax only on some combobox in the intranet web page where i work... useful to update info on the page without having an anoying pageload...

    Tell me, why on earth would i use ajax for mouse move events? And do you know me or anything.....

    Have a look at telerik's website, they have some pretty nice asp.net controls using Ajax (www.telerik.net) which dont actually query the server on every mouse move....

    Thanks for being an ass

  • Jason Kester (unregistered) in reply to Alf
    Tell me, why on earth would i use ajax for mouse move events?

    check out http://www.ktracker.com for an application that does exactly that. It's a usability tool that lets you watch visitors using your site by actually replaying their sessions.

    Jason

  • (cs) in reply to Otac0n
    Otac0n:

    I have actually been guilty of creating this kind of search engine :(

     

    Well, I did do something similar here: http://ghostrecon.tacticalnet.org/search.html

    Except that it does not use arrays for searching but and XML file.

    Oh and IE only, sorry about that... And the normal View Source isn't going to make too much sense.

    Drak

  • Andrey (unregistered)

    But does it support regular expressions?

  • (cs) in reply to Florian
    Florian:
    ammoQ:
    Anonymous:
    Why does everyone hate on JavaScript so much here?

    Several possibilities...
    a) It's an extremely cheap clone of an already poor language.

    Common Lisp is poor in what respect, again?

    JavaScript a clone of ((common) (lisp))? (((Hard) to) (believe) - (((something) (is)) missing)) ;-)


    b) It grew in an unhealthy way and lacks a proper concept.

    It is one of the few languages that do in fact have a formal semantics, so it is among the healthiest languages out there (that does not imply that the implementations are healthy, too).

    Having formal semantics is enough to qualify as "healthy"? That's so sad...

  • (cs) in reply to Casiotone
    Casiotone:
    Saving bandwidth is a WTF?


    If you mean the original WTF: yes, because it does NOT save bandwidth - quite the opposite, in fact. All the keywords and stuff are transmitted every time the page is loaded, making it considerably bigger than it would otherwise be - and the search feature will probably not be used upwards of 95% of the time.

Leave a comment on “The JavaScript Search Engine”

Log In or post as a guest

Replying to comment #:

« Return to Article