Riak, now with Search

Riak is distributed key-value store which now has easy full text search.

Install Riak Search before continuing.

Put riaksearch/bin in your session PATH:

export PATH=/path/to/riaksearch/bin:$PATH

Enable indexing on the “companies” and “testimonials” buckets:

search-cmd install companies
search-cmd install testimonials

Create some convenience functions for easier KV ops:

# USAGE: riak_post "bucket" "value"
function riak_post { 
    curl -v -d "$2" -H "Content-type: text/plain" "http://127.0.0.1:8098/riak/$1"
}

# USAGE: riak_put "key" "value"
function riak_put { 
    curl -v -X PUT -d "$2" -H "Content-type: text/plain" "http://127.0.0.1:8098/riak/$1"
}

Add some facts about a couple of companies I really like:

riak_post companies "\
Verafin is one of North America's leading BSA/AML \
Compliance and Fraud Detection software providers."

riak_post companies "\
Verafin was founded in 2003 by a team of computer \
engineers with a background in artificial intelligence and \
pattern recognition. We have become recognized as a \
thought leader for delivering an innovative solution to the \
financial services industry by introducing unconventional and \
sophisticated artificial intelligence technologies that \
traditionally have only been used in the field of science."

riak_post companies "\
Basho Technologies, Inc., founded in January 2008 by a core group of \
Software Architects, Engineers and Executive Leadership from Akamai \
Technologies, Inc. (NASDAQ:AKAM) is headquartered in Cambridge, \
Massachusetts."

riak_post companies "\
Basho works with a wide array of companies from various industries, \
spanning FORTUNE 100 companies like Comcast to innovative startups \
like Mochi Media, Opscode, and SelfServeApps."

Add a couple of testimonials from happy customers of those same companies:

riak_post testimonials "\
\"Verafin staff have an understanding of the whole objective and end \
goal which leaves them open to recommendations for enhancements and \
accommodation in fulfilling requests. I think overall, with Verafin \
I know we have options versus just what the company is willing to \
provide. I totally enjoy working with Verafin.\" Phyllis B, IN"

riak_post testimonials "\
\"A big thank you to the guys at Basho for Riak, its seriously \
awesome.\" Jebu Ittiachen, Inagist.com"

What are the facts we know about Verafin?

search-cmd search companies Verafin

I got back (keys will ):

 :: Searching for 'Verafin' in companies...

------------------------------

index/id: companies/7008zOvhqaNLMpQ2ISSVCzsPYFP
p -> [0]
score -> 0.5

------------------------------

index/id: companies/XIEUYXungQb9DWMOAYyVvc9OlEb
p -> [0]
score -> 0.5

------------------------------

 :: Found 2 results.

What are people saying about Verafin?

search-cmd search testimonials Verafin

I got back:

 :: Searching for 'Verafin' in testimonials...

------------------------------

index/id: testimonials/R4oIibVNRzqr4Nean6D5jkn8nHO
p -> [0,20,34]
score -> 0.8660254037844386

------------------------------

 :: Found 1 results.

What are the facts we know about Basho?

search-cmd search companies Basho

I got back:

 :: Searching for 'Basho' in companies...

------------------------------

index/id: companies/JD1h3Erznyj47AKHKwPx0zyWddi
p -> [0]
score -> 0.5

------------------------------

index/id: companies/T8kqjUkWIOgvUDaIHExkSbiJCU8
p -> [0]
score -> 0.5

------------------------------

 :: Found 2 results.

What are people saying about Basho?

search-cmd search testimonials Basho

I got back:

 :: Searching for 'Basho' in testimonials...

------------------------------

index/id: testimonials/YqSiksF5WQmSGlKNmM1udPXm6vx
p -> [4]
score -> 0.5

------------------------------

 :: Found 1 results.

Why not get some really snazzy XML with actual content using the Solr interface?

curl "http://localhost:8098/solr/companies/select?start=0&rows=10000&q=Verafin"

curl "http://localhost:8098/solr/testimonials/select?start=0&rows=10000&q=Verafin"

curl "http://localhost:8098/solr/companies/select?start=0&rows=10000&q=Basho"

curl "http://localhost:8098/solr/testimonials/select?start=0&rows=10000&q=Basho"
Bear in mind that values in a bucket before search was enabled are not automatically indexed. Enjoy your distributed masterless key-value store even more now that it has full text search. Yeah, this is pretty awesome. Thank you Basho for this great addition to Riak :)