Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Okay. I have a better idea of what you're doing now. First of all, I'd recommend using MongoDB (or maybe even Redis) to store the politicians, not an XML file. Think about it. Many people will be doing searches. If you're searching and then I try to search, I'll have to wait for you to finish accessing the XML file before I can. Databases should be used instead of files if many people will be accessing the same data concurrently. Even if just one person is searching, the file must be opened &amp; closed every time you type something. Databases are much faster for this kind of thing, esp. MongoDB cause this happens all in ram. Just remember to put an index on what you're searching for, in this case, the politician's name.</p> <p>Also, how many politicians are there? If it's less than 5,000 or so, you could do what Facebook used to do with your friends: insert a JSON array of all your friends' ids on the initial page load. So, you could output upfront a JSON array of all the politician's names &amp; ids and then do the livesearch all on the client with JavaScript. Look into jQuery. <a href="http://ejohn.org/blog/jquery-livesearch/" rel="nofollow">http://ejohn.org/blog/jquery-livesearch/</a></p> <p>If you're going to use AJAX, I recommend using jQuery as well because it's easier and takes care of browser compatibility issues for you. (Your code might not work in certain browsers.) And jQuery is also very helpful for other event handling and modifying the DOM, which you're also doing in your code. So, you could use it for a lot of things you're already doing a more difficult way with JavaScript. Also, use MongoDB (check out MongoHQ for free hosting). I also think you'll find Sinatra much easier than PHP, and it's free &amp; easy to host on Heroku, and you can also hook it up to MongoDB. That's what I'm doing with acani <a href="http://github.com/acani/acani" rel="nofollow">http://github.com/acani/acani</a></p> <p><a href="http://webhole.net/2009/08/31/how-to-read-json-data-with-php/" rel="nofollow">http://webhole.net/2009/08/31/how-to-read-json-data-with-php/</a></p> <p>Scala or Node.js would also be faster than PHP or Ruby.</p> <p>Matt</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload