Reputation: 1052
I'm using Riak as a key-value store backend for a graph database implemented in Python.
I created a custom search schema named nodes
.
I created and activated a bucket type nodes
with the search_index
property set to nodes
and the datatype
property set to map
.
I inserted the following data into the bucket default
(with bucket type nodes
):
key: node1
value: {
"type_set": {"n1"},
"foo_set": {"bar", "baz"}
}
NB: the data is automatically transformed into a Map datatype.
I can fetch the data correctly, but I tried the following fulltext searches and no document is returned:
type_set:n1
type_set:*n1*
type_set:*
foo_set:*
_yz_rk:node1
_yz_rk:*
It seems that my document is not indexed.
I also tried to set the search_type
property to nodes
on the bucket default
, but I got the same result.
The parameter search
is set to on
in the configuration file (/etc/riak/riak.conf
) and the OpenJDK 7 is installed.
I have no idea what I'm doing wrong, if anyone can help me, thanks in advance.
Upvotes: 2
Views: 115
Reputation: 3153
First, you should take into account that Riak automatically adds suffix _set
, so that you don't have to name yours type_set
but type
. Otherwise you will have to query for type_set_set:*
instead of type_set:*
.
Second, according to Data Type Schemas, embedded schemas (as opposed to top-level ones) must use dynamic fields. Apparently Riak prepends field names with some internal identifier of the top-level map. Unfortunately, this also means that you cannot index one set without indexing the other as well.
I've run some tests and found out that <dynamicField name="*_set" type="string" indexed="true" stored="true" multiValued="true"/>
works fine, while <dynamicField name="*type_set" type="string" indexed="true" stored="true" multiValued="true"/>
does not.
Upvotes: 1