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" => "[email protected]") with key "id_1"
array("name" => "Ray_7", "age" => rand(25, 90), "email" => "[email protected]") with key "id_2"
array("name" => "Ray_8", "age" => rand(25, 90), "email" => "[email protected]") 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.
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:
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.