6. Search = sphinx
• moving from ultrasphinx to thinking_sphinx
• more actively developed
• nice syntax
• we are overhauling search
7. geo-search
• sphinx does this very well
• insists on radians
• ultrasphinx provides a nice interface
# CREATE AN INDEX
define_index do
indexes :name
has quot;RADIANS(latitude)quot;, :as => :latitude, :type => :float
has quot;RADIANS(longitude)quot;, :as => :longitude, :type => :float
end
# RUN A SEARCH for popular bars nearby
@bars = Listing.search(quot;barquot;,
:per_page => 10,
:page => 1,
:geo => [deg2rad(@where.latitude), deg2rad(@where.longitude)],
:order => average_rating DESC,
:with => {quot;@geodistquot; => 0.0..2000})
8. caching - in order of preference
1. Page caching
2. Action caching
3. Fragment caching
9. Caching
Page caching not possible if
content changes for ANY
user *
Action caching can be used
conditionally - for logged out
users
caches_action :show ,
:if => Proc.new { |controller| controller.send(:logged_out?) }
* unless server side includes (SSI) are used
10. 20,000 action cached places
But... the footer is dynamic
How to keep the action cache but
change the footer?
11. Server Side Includes
Wikipedia:
“As its name implies, its primary use is including the
contents of one file into another one dynamically when
the latter is served by a web server.”
<!--# include virtual=quot;/ssi/footerquot; -->
The webserver inserts the contents of the include
before sending the response to the client
http://blog.kovyrin.net/2007/08/05/using-nginx-ssi-and-memcache-to-make-your-web-applications-faster/
http://www.jkraemer.net/tags/nginx
12. also...
• Object caching can be handy for expensive queries
• these objects can be fetched out of request/
response cycle (we use workling for this)
• don’t keep page cache in RAILS_ROOT/public -
this will preserve it through redeploys
http://blog.hasmanythrough.com/2008/1/30/segregated-page-cache-storage
13. RateMyArea on your mobile
(if you have an iPhone)
• We like MobileSafari!
• iUi used for the interface
• development has stalled
• good starting point...
• Flickr agree with copied us :)
http://code.flickr.com/blog/2008/10/27/lessons-learned-while-building-an-iphone-site/
14. RateMyArea on your mobile
(if you have an iPhone)
• No access to CoreLocation through the browser :(
• phonegap can fix this
• native iPhone app
• wraps a web-app
• really is a site specific browser
• http://github.com/sintaxi/phonegap/tree/master
15. Maps on the iPhone
• Native app is really nice
• can render kml
• different firmware versions have different
capabilities :(