<meta charset="utf-8">Hi Morten,<div><br></div><div>The error message is indicating that your document contains an "<span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">organizations_name" field, but that the field doesn't exist in your schema. Your options are to either add a field definition for "</span><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">organizations_name" to the schema, or add a dynamic field definition to the end of your schema that catches any fields that weren't previously matched, and maps them to some data type.</span></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; ">The wiki contains more information on dynamic fields (<a href="http://wiki.basho.com/Riak-Search---Schema.html">http://wiki.basho.com/Riak-Search---Schema.html</a>) but you can also just copy the entries from the default schema.</span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; ">Best,</span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; ">Rusty</span></font></div><br><div class="gmail_quote">On Wed, Mar 9, 2011 at 9:27 AM, Morten Siebuhr <span dir="ltr"><<a href="mailto:sbhr@sbhr.dk">sbhr@sbhr.dk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi all,<br>
<br>
I'm trying to use Riak + Riaksearch as a datastore for Portable<br>
Contacts [1], but I'm running into a spot of trouble making riaksearch<br>
actually work;<br>
<br>
I've set up riaksearch with the following schema document:<br>
<br>
{<br>
        schema,<br>
        [<br>
                {version, "0.1"}, {default_field, "_owner"}, {n_val, 1}<br>
        ],<br>
        [<br>
                %% Don't parse _id and _owner, just treat it as single token<br>
                {field, [       {name, "id"},<br>
                                {required, true},<br>
                                {analyzer_factory, {erlang, text_analyzers, noop_analyzer_factory}}<br>
                        ]},<br>
                {field, [       {name, "_owner"},<br>
                                {required, true},<br>
                                {analyzer_factory, {erlang, text_analyzers, noop_analyzer_factory}}<br>
                        ]},<br>
                %% Parse Name fields for full-text indexing<br>
                {field, [       {name, "displayName"},<br>
                                {aliases, ["nickname", "preferredUsername", "name_formatted",<br>
"name_displayName"]},<br>
                                {analyzer_factory, {erlang, text_analyzers, standard_analyzer_factory}}<br>
                        ]},<br>
                {field, [       {name, "emails_value"},<br>
                                {analyzer_factory, {erlang, text_analyzers, standard_analyzer_factory}}<br>
                        ]},<br>
<br>
                %% Add modification dates<br>
                {field, [       {name, "published"},<br>
                                {aliases, ["updated"]},<br>
                                {type, date}<br>
                        ]}]}.<br>
<br>
(Edited slightly for shortness...)<br>
<br>
I then add it using<br>
> sudo sudo search-cmd set_schema PortableContacts `pwd`/pocolib/drivers/riak-search/schema.erl<br>
<br>
And enable it on the 'PortableContacts' bucket:<br>
> sudo search-cmd install PortableContacts<br>
<br>
(BTW: It is not entirely clear from<br>
<a href="https://wiki.basho.com/Riak-Search---Schema.html" target="_blank">https://wiki.basho.com/Riak-Search---Schema.html</a> if the schema name<br>
must match the bucket it should work for. At least, I'm not entirely<br>
sure.)<br>
<br>
But when I then try to push a contact entry, it coughs up an 500<br>
Internal Server Error:<br>
<br>
curl -v -d '{"organizations": [{"name": "nickels principles", "title":<br>
"curvier floppies"}], "displayName": "reverberating agrarian clue",<br>
"name": {"givenName": "reverberating", "formatted": "reverberating<br>
agrarian clue", "familyName": "agrarian clue"}, "emails": [{"value":<br>
"<a href="mailto:shortcut@example.com">shortcut@example.com</a>"}], "_owner": "<a href="mailto:msi@one.com">msi@one.com</a>", "published":<br>
"2010-04-26T13:10:33Z", "id": "48cad5d0-f057-4316-905e-281d1da32a01"}'<br>
-H "Content-Type: application/json"<br>
<a href="http://localhost:8098/riak/PortableContacts/48cad5d0-f057-4316-905e-281d1da32a01" target="_blank">http://localhost:8098/riak/PortableContacts/48cad5d0-f057-4316-905e-281d1da32a01</a><br>
* About to connect() to localhost port 8098 (#0)<br>
*   Trying ::1... Connection refused<br>
*   Trying 127.0.0.1... connected<br>
* Connected to localhost (127.0.0.1) port 8098 (#0)<br>
> POST /riak/PortableContacts/48cad5d0-f057-4316-905e-281d1da32a01 HTTP/1.1<br>
> User-Agent: curl/7.19.7 (i486-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/<a href="http://1.2.3.3" target="_blank">1.2.3.3</a> libidn/1.15<br>
> Host: localhost:8098<br>
> Accept: */*<br>
> Content-Type: application/json<br>
> Content-Length: 396<br>
><br>
< HTTP/1.1 500 Internal Server Error<br>
< Vary: Accept-Encoding<br>
< Server: MochiWeb/1.1 WebMachine/1.7.3 (participate in the frantic)<br>
< Date: Wed, 09 Mar 2011 13:51:50 GMT<br>
< Content-Type: text/html<br>
< Content-Length: 749<br>
<<br>
<html><head><title>500 Internal Server<br>
Error</title></head><body><h1>Internal Server Error</h1>The server<br>
encountered an error while processing this<br>
request:<br><pre>{error,{error,badarg,<br>
              [{erlang,iolist_to_binary,<br>
                       [{error,missing_field,<<"organizations_name">>}]},<br>
               {wrq,append_to_response_body,2},<br>
               {riak_kv_wm_raw,accept_doc_body,2},<br>
               {webmachine_resource,resource_call,3},<br>
               {webmachine_resource,do,3},<br>
               {webmachine_decision_core,resource_call,1},<br>
               {webmachine_decision_core,decision,1},<br>
* Connection #0 to host localhost left intact<br>
* Closing connection #0<br>
               {webmachine_decision_core,handle_request,2}]}}</pre><P><HR><ADDRESS>mochiweb+webmachine<br>
web server</ADDRESS></body></html><br>
<br>
<br>
Any ideas as to where I'm doing something wrong?<br>
<br>
I'm using version 0.14.0-1 of both products on Ubuntu 10.4 x86.<br>
<br>
[1] <a href="http://portablecontacts.net/draft-spec.html" target="_blank">http://portablecontacts.net/draft-spec.html</a><br>
<font color="#888888"><br>
--<br>
Morten Siebuhr<br>
<br>
_______________________________________________<br>
riak-users mailing list<br>
<a href="mailto:riak-users@lists.basho.com">riak-users@lists.basho.com</a><br>
<a href="http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com" target="_blank">http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com</a><br>
</font></blockquote></div><br>