How to index List<Class> in riak so that it will available for solr

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to index List<Class> in riak so that it will available for solr

Anil Chandgude(HO)


Hi all,

    We use    *_s for String type, *_i for Integers and so on for single value fields.
*_ss for List<String>, *_ls for List<Long> nd so on.
Now I have condition where I want to store List of class like this List<SampleClass> . How to do this ?

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: How to index List<Class> in riak so that it will available for solr

Fred Dushin
Hi Anil,

Thanks for your question.

Riak uses the HTTP interface for inserting data into Solr, not Solrj.  We do not therefore support indexing POJOs -- they must be translated to a form that is consumable by the HTTP interface (internally we use JSON, but Riak natively supports several structured data formats).

You can write your own extractors [1] for transforming opaque data structures into structured data, but these are written in Erlang executed in the Riak/Erlang abstract machine (BEAM).  It would likely pose a technical challenge to write a POJO extractor in Erlang, and you might be better off doing this outside of the BEAM, say, in Java, using reflection or some tool that translates Java objects to structured data (XML/JSON).  JAX-B comes to mind as one potential avenue, though that requires a fairly heavy investment in XML-schema, code generation, and so forth, though the Java world is pretty rich with tools for managing all of that.

I hope that answers your question.

-Fred

[1] http://docs.basho.com/riak/kv/2.1.4/developing/usage/search/#extractors


> On Apr 22, 2016, at 1:48 AM, Anil Chandgude(HO) <[hidden email]> wrote:
>
>
>
> Hi all,
>
>     We use    *_s for String type, *_i for Integers and so on for single value fields.
> *_ss for List<String>, *_ls for List<Long> nd so on.
> Now I have condition where I want to store List of class like this List<SampleClass> . How to do this ?
> _______________________________________________
> riak-users mailing list
> [hidden email]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com