not able to create schema

Rusty Klophaus rusty at basho.com
Wed Feb 23 08:52:53 EST 2011


Hi Wilson,

Can you double check the error message? You are trying to store a document
in index "testindex", but the error message states an index of "testUser".
Could this be an old error.

Also, the 'search' module is only intended to be run from within a Riak
Search node. It's intended to be a simple way of interacting with data
directly while bypassing the need for a client. It looks like you may be
trying to run it on a client node, which would explain the "bad argument"
error.

You should interact with Riak Search through one of the other client APIs
that currently support Riak Search (currently Erlang, Ruby, Python, and PHP
clients).

Best,
Rusty


On Wed, Feb 23, 2011 at 5:47 AM, wilson Tuladhar <mailwilson007 at gmail.com>wrote:

> Hi,
>
> For indexing my data, I have created a schema as
>
> {
> schema,
> [
>         {version, "1.0"},
>         {default_field, "fname"},
>         {default_op, "or"},
>         {n_val, 3},
>         {analyzer_factory, {erlang, text_analyzers,
> whitespace_analyzer_factory}}
>     ],
>     [
>         %% Parse the field in preparation for full-text searching.
>         {field, [
>             {name, "fname"},
>             {required, true},
>             {analyzer_factory, {erlang, text_analyzers,
> standard_analyzer_factory}}
>         ]},
>
>         %% Treat the field as a date, which currently uses
> noop_analyzer_factory.
>         {field, [
>             {name, "lname"},
>             {analyzer_factory, {erlang, text_analyzers,
> standard_analyzer_factory}}
>         ]},
>
>         %% A dynamic field. Catches any remaining fields in the
>         %% document, and uses the analyzer_factory setting defined
>         %% above for the schema.
>         {dynamic_field, [
>             {name, "*"}
>         ]}
>     ]
> }.
>
>
> and I have stored it in a file user_schema.
> Then, I set the schema using command:
> bin/search-cmd set_schema "testindex" user_schema
> and when i use bin/search-cmd show_schema "testindex" it displays my schema
>
> now when I try to use this index name for indexing my document as :
> search:index_doc(<<"testindex">>, <<"my_doc">>, [{<<"fname">>,
> <<"Fname">>}, {<<"lname">>, <<"Lname">>}])
> it gives me this error:
> ** exception error: bad argument
>      in function  ets:lookup/2
>         called as ets:lookup(schema_table,<<"testUser">>)
>      in call from riak_search_config:get_schema/1
>      in call from riak_indexed_doc:new/4
>      in call from search:index_doc/4
>
> and when i check ets:all() i don't see schema_table in the list??
>
> So, am i missing something to store the schema or am i doing something
> wrong???
>
> //Wilson
>
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20110223/552e723e/attachment.html>


More information about the riak-users mailing list