cloudspokes/cs-website-cms — pull request #10 by parasquid (2012-12-17 21:34:21+00:00)
Title: Cs 1925 search with redis

Screenshot here: https://docs.google.com/open?id=0ByOHFQqUBIHkbTJaUjVLdzl2OFU

Implemented:
- Searching by a prize money range
- Search by number of people involved in the challenges (where registered members =, <, or > ?)
- Search by community (checkboxes) - a challenge can below to a "community" (e.g., Java community or Docu
- Display challenge type
- Number of people registered
- The portion of the description (first x characters)
- Due date
- Categories (like how soe did it on the demo site)
- Community the challenge belongs to (if any)

Not yet implemented (will be implemented in a later commit, probably tomorrow):
- Sorting by prize money
- Sorting by challenge type

Inserting and Updating challenges work the same way as soe did -> via a post action on /challenges/populate

I felt this was the most flexible solution, as creating and updating the redis entries is as easy as posting a json array of challenges in that endpoint. The challenges are keyed via their challenge_id property, so if a challenge json has the same challenge_id it will update the entry in redis.

I'm using Ohm as the ORM with a few custom functions for range finds. It uses the environment variable REDIS_URL so if deploying to heroku and using the redistogo heroku addon, you need to run:

heroku config:set REDIS_URL=`heroku config:get REDISTOGO_URL`

I've tried to cleanup the url as much as I can (I decided in accepting url params in a get request for ease of bookmarking).