Hi all,
I'm trying to use Riak + Riaksearch as a datastore for Portable
Contacts [1], but I'm running into a spot of trouble making riaksearch
actually work;
I've set up riaksearch with the following schema document:
{
schema,
[
{version, "0.1"}, {default_field, "_owner"}, {n_val, 1}
],
[
%% Don't parse _id and _owner, just treat it as single token
{field, [ {name, "id"},
{required, true},
{analyzer_factory, {erlang, text_analyzers,
noop_analyzer_factory}}
]},
{field, [ {name, "_owner"},
{required, true},
{analyzer_factory, {erlang, text_analyzers,
noop_analyzer_factory}}
]},
%% Parse Name fields for full-text indexing
{field, [ {name, "displayName"},
{aliases, ["nickname", "preferredUsername",
"name_formatted",
"name_displayName"]},
{analyzer_factory, {erlang, text_analyzers,
standard_analyzer_factory}}
]},
{field, [ {name, "emails_value"},
{analyzer_factory, {erlang, text_analyzers,
standard_analyzer_factory}}
]},
%% Add modification dates
{field, [ {name, "published"},
{aliases, ["updated"]},
{type, date}
]}]}.
(Edited slightly for shortness...)
I then add it using
> sudo sudo search-cmd set_schema PortableContacts
> `pwd`/pocolib/drivers/riak-search/schema.erl
And enable it on the 'PortableContacts' bucket:
> sudo search-cmd install PortableContacts
(BTW: It is not entirely clear from
https://wiki.basho.com/Riak-Search---Schema.html if the schema name
must match the bucket it should work for. At least, I'm not entirely
sure.)
But when I then try to push a contact entry, it coughs up an 500
Internal Server Error:
curl -v -d '{"organizations": [{"name": "nickels principles", "title":
"curvier floppies"}], "displayName": "reverberating agrarian clue",
"name": {"givenName": "reverberating", "formatted": "reverberating
agrarian clue", "familyName": "agrarian clue"}, "emails": [{"value":
"[email protected]"}], "_owner": "[email protected]", "published":
"2010-04-26T13:10:33Z", "id": "48cad5d0-f057-4316-905e-281d1da32a01"}'
-H "Content-Type: application/json"
http://localhost:8098/riak/PortableContacts/48cad5d0-f057-4316-905e-281d1da32a01
* About to connect() to localhost port 8098 (#0)
* Trying ::1... Connection refused
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 8098 (#0)
> POST /riak/PortableContacts/48cad5d0-f057-4316-905e-281d1da32a01 HTTP/1.1
> User-Agent: curl/7.19.7 (i486-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k
> zlib/1.2.3.3 libidn/1.15
> Host: localhost:8098
> Accept: */*
> Content-Type: application/json
> Content-Length: 396
>
< HTTP/1.1 500 Internal Server Error
< Vary: Accept-Encoding
< Server: MochiWeb/1.1 WebMachine/1.7.3 (participate in the frantic)
< Date: Wed, 09 Mar 2011 13:51:50 GMT
< Content-Type: text/html
< Content-Length: 749
<
<html><head><title>500 Internal Server
Error</title></head><body><h1>Internal Server Error</h1>The server
encountered an error while processing this
request:<br><pre>{error,{error,badarg,
[{erlang,iolist_to_binary,
[{error,missing_field,<<"organizations_name">>}]},
{wrq,append_to_response_body,2},
{riak_kv_wm_raw,accept_doc_body,2},
{webmachine_resource,resource_call,3},
{webmachine_resource,do,3},
{webmachine_decision_core,resource_call,1},
{webmachine_decision_core,decision,1},
* Connection #0 to host localhost left intact
* Closing connection #0
{webmachine_decision_core,handle_request,2}]}}</pre><P><HR><ADDRESS>mochiweb+webmachine
web server</ADDRESS></body></html>
Any ideas as to where I'm doing something wrong?
I'm using version 0.14.0-1 of both products on Ubuntu 10.4 x86.
[1] http://portablecontacts.net/draft-spec.html
--
Morten Siebuhr
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com