Hi,
If I want to put a json object which has an array of integers, like:
{
"users" : [ 1971, 7844 ]
}
and index that as integers with the schema:
{field, [
{name, "users"},
{type, integer},
{analyzer_factory, {erlang, text_analyzers, integer_analyzer_factory}}
]},
The indexing works (I am assuming correctly) and I have these values in the
index document:
{<<"users">>,<<"1971 7844">>, [{<<"1971">>,[0]},{<<"7844">>,[1]}]}
However, in my schema I have the type as integer for this index, and when I
get the object I get an error for riak_search_utils:to_integer is failing,
because this is not valid:
list_to_integer("1971 7844")
I patched the to_integer function so that if it is a single integer, it just
returns list_to_integer("1971"), but if there is more than one integer, it
will return a list of integers, like so:
1) single integer values: 1971
2) list of integer values: [1971, 7844]
My question now is, is that acceptable behavior to return a list of integers
in this case? It seems to work fine with search and all, but I haven't
tested it extensively. Also, it's kind of hacky and only applies to the
to_integer function.
- Joe Lambert
[email protected]
+86 13656213284
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com