1

I've installed Riak 1.0.2 on Ubuntu Natty.

I have also added some sample data to the database. I'm using a LevelDB backend because I want to test the Secondary Indexing functionality.

I added a test_1 bucket. And to that bucket I added the following information.

array("name" => "Ray_6", "age" => rand(25, 90), "email" => "addr_6@orbican.com") with key "id_1"
array("name" => "Ray_7", "age" => rand(25, 90), "email" => "addr_7@orbican.com") with key "id_2"
array("name" => "Ray_8", "age" => rand(25, 90), "email" => "addr_8@orbican.com") with key "id_3"

I'm trying to use the Search feature to query this data. Below is the CURL request that I enter into the command line:

curl http://localhost:8098/solr/test_1/select?q=name:Ray_6

But when I do this, I get a no found error.

Is there something I'm missing? Am I supposed to do something to the bucket to make it searchable?

I'd appreciate some assistance.

Thanks in advance.

ObiHill
  • 11,448
  • 20
  • 86
  • 135

1 Answers1

2

Well, firstly, the above URL is using Riak Search and not the secondary indexes. The URL to query a secondary index is in the form of:

/buckets/<bucket>/index/<fieldname_bin>/query

You form a secondary index by adding metadata headers when creating a record through the cURL interface. Client libraries for different languages will generate this for you.

Back to your specific question, though. Did you use the search-cmd tool to install an index for the test_1 bucket? If you did, did you have data in the bucket before doing so? Riak Search will not retroactively index your data. There are a few ways available to do so, but both are time-consuming if this is just an experimental app.

If you don't have much data, I suggest you re-enter it after setting up the index. Otherwise, you need to add secondary index or process it through the search API as you read/write a piece of data. It'll take time, but it's what is available through Riak now.

Hope this helps.

Srdjan Pejic
  • 8,152
  • 2
  • 28
  • 24
  • Thanks for the comment. I just figured out that I needed to (1) enable riak_search in my app.config and (2) add a pre-commit hook to the bucket. Will post the answer shortly – ObiHill Jan 25 '12 at 19:38