2009 03 19 Search In Your Rails App

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Notes on slide 1

    - Welcome
    - Beer and pizza sponsored by Brightbox
    - Please consider talking!


    -- So why not just use the DB?


    - building SQL in code, easy to introduce mistakes - in with image
    - Someone has already handled the hard stuff, stop-word removal, stemming, that sort of thing
    - DB’s are traditionally the hardest element of a stack to scale, lets not put more stuff there. One of the main points.
    - Luckily there are a bunch of alternatives, next slide

    …and sphinx is one - Standalone - runs as a separate process
    - written in c, small memory footprint
    - stable
    - high indexing speed (upto 10 MB/sec on modern CPUs)
    - high search speed (avg query is under 0.1 sec on 2-4 GB text collections)
    - high scalability (upto 100 GB of text, upto 100 M documents on a single CPU)
    - supports distributed searching (since v.0.9.6)

    - Most importantly… read
    - Don’t let anyone try to convince you otherwise with shady propaganda

    Installing sphinx is easy

    - indexer, builds indexes
    - searchd, where the magic happens

    - Not much use to us unless we can use it with our applications, we have two choices
    - Both widely used at EY
    - differences


    Demo!



    Favorites, Groups & Events

    2009 03 19 Search In Your Rails App - Presentation Transcript

    1. NWRUG March 2009 Sponsored by:
    2. Search • Sphinx + Thinking Sphinx (Will Jessop) • Solr (Asa Calow) • Ferret, and maybe Xapian (John Leach)
    3. Sphinx + Thinking Sphinx Will Jessop
    4. All you need is… >> query = \"The cat sat on the mat\" => \"The cat sat on the mat\" >> where = \"(email like '%#{ query.split(/\\s+/).map{|term| term.downcase }.join(\"%') OR (email like '%\") }')\" => \"(email like '%the%') OR (email like '%cat%') OR (email like '%sat%') OR (email like '%on%') OR (email like '%the%') OR (email like '%mat')\" >>execute(“select * from users where #{where}”) => fail PHP Congratulations, you are now a l33t programmer! ^ Job done!
    5. All you need is… >> query = \"The cat sat on the mat\" => \"The cat sat on the mat\" >> where = \"(email like '%#{ query.split(/\\s+/).map{|term| term.downcase }.join(\"%') OR (email like '%\") }')\" => \"(email like '%the%') OR (email like '%cat%') OR (email like '%sat%') OR (email like '%on%') OR (email like '%the%') OR (email like '%mat')\" >>execute(“select * from users where #{where}”) => fail PHP Congratulations, you are now a l33t programmer! ^ Job done!
    6. Why not use the DB? • Building up SQL queries in code sucks • Full text indexing in DBs isn’t great either • DB’s are hard to scale
    7. Why not use the DB? • Building up SQL queries in code sucks • Full text indexing in DBs isn’t great either • DB’s are hard to scale
    8. Sphinx is… • Sphinx is a full-text search engine • Open source (GPL version 2) • Standalone • Proven stable • Performs well
    9. Sphinx Much better than Solr and Ferret
    10. Sphinx Much better than Solr and Ferret Maybe
    11. Installing sphinx sudo port install sphinx
    12. Out of the box • indexer - utility which creates fulltext indexes • searchd - daemon which enables external software to search fulltext indexes Amongst other things
    13. Using with your app Two Ruby on Rails APIs • Ultra Sphinx • Thinking Sphinx
    14. Installing Ultra Sphinx cd rails_app && script/plugin install git://github.com/ freelancing-god/thinking-sphinx.git
    15. Questions
    16. Resources • http://reinh.com/blog/2008/07/14/a- thinking-mans-sphinx.html • http://ts.freelancing-gods.com/ • http://ts.freelancing-gods.com/rdoc/ • http://www.sphinxsearch.com/

    + will_jwill_j, 7 months ago

    custom

    711 views, 0 favs, 0 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 711
      • 711 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 11
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories