Riak Search on KV data in erlang terms

Takeshi Matsumura takeshi4126 at gmail.com
Tue Jan 22 10:15:09 EST 2013


Hi,

I tried to store erlang data and query them by using the Riak Search without success so far, and thus would like to ask if I'm doing the right thing. Riak Search was enabled in the app.config file and the server was restarted. The pre-commit hook was installed from the command line.

bin/search-cmd install mybucket

The erlang data that I uploaded is a proplists with a single pair of key and value.

[{"name", "bob"}]

It was uploaded by using the curl command with Content-Type "application/x-erlang". (hoge.erl.txt contains the above erlang terms).

curl -v -d @hoge.erl.txt -X PUT -H "content-type: application/x-erlang" "http://localhost:8098/riak/mybucket/bob"

I could get the document by issuing curl command to "/riak/mybucket/bob". The HTTP response header contained the correct Content-Type, "application/x-erlang".

Then I run the Riak Search from the command line.

bin/search-cmd search mybucket "name:bob"

Unfortunately, the result said "Found 0 results".

As I wondered if this is a problem related to the erlang terms, I tried the same with a JSON data that is found in the "Indexing and Querying KV Data" page but setting "application/json" to the Content-type.

{
 "name":"Alyssa P. Hacker",
 "bio":"I'm an engineer, making awesome things.",
 "favorites":{
              "book":"The Moon is a Harsh Mistress",
              "album":"Magical Mystery Tour"
             }
}

Then the Riak Search could find this document with the query "name:Alyssa*".

According to the "Indexing and Querying KV Data" page of the Riak document, erlang terms can be queried by using the Riak Search. However, it is unclear to me if it is enabled by default because the page says XML, JSON, and plain-text encodings are supported out of the box but it doesn't mention the erlang terms.

I followed the "Other Data Encodings" section and set the "riak_search_kv_erlang_extractor" module, but it didm't change the situation.

curl -XPUT -H 'content-type: application/json' \
    http://localhost:8098/riak/mybucket \
    -d '{"props":{"search_extractor":{"mod":"riak_search_kv_erlang_extractor", "fun":"extract", "arg":"my_arg"}}}'

I changed the data as follows and uploaded but it didn't help either.

[{<<"name">>, <<"bob">>}]

I appreciate any hints for me to go forward. Thank you in advance.

Best regards,
 Takeshi


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20130123/8871b18c/attachment.html>


More information about the riak-users mailing list