You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Shalin Shekhar Mangar <sh...@gmail.com> on 2009/11/02 17:35:32 UTC

Re: Annotations and reference types

On Thu, Oct 29, 2009 at 7:57 PM, M. Tinnemeyer <ma...@gmx.net> wrote:

> Dear listusers,
>
> Is there a way to store an instance of class A (including the fields from
> "myB") via solr using annotations ?
> The index should look like : id; name; b_id; b_name
>
> ----------
> Class A {
>
> @Field
> private String id;
> @Field
> private String name;
> @Field
> private B myB;
> }
>
> ----------
> Class B {
>
> @Field("b_id")
> private String id;
> @Field("B_name")
> private String name;
> }
>
>
No.

I guess you want to represent certain fields in class B and have them as an
attribute in Class A (but all fields belong to the same schema), then it can
be a worthwhile addition to Solrj. Can you open an issue? A patch would be
even better :)

-- 
Regards,
Shalin Shekhar Mangar.

Re: Annotations and reference types

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@corp.aol.com>.
I guess this is not a very good idea.

The document itself is a flat data structure. It is hard to see that
is nested datastructure. If allowed , how deep would we wish to make
it.

The simple solution would be to write setters for "b_id" and "b_name" in class A
and the setters can inject values into B.

On Mon, Nov 2, 2009 at 10:05 PM, Shalin Shekhar Mangar
<sh...@gmail.com> wrote:
> On Thu, Oct 29, 2009 at 7:57 PM, M. Tinnemeyer <ma...@gmx.net> wrote:
>
>> Dear listusers,
>>
>> Is there a way to store an instance of class A (including the fields from
>> "myB") via solr using annotations ?
>> The index should look like : id; name; b_id; b_name
>>
>> ----------
>> Class A {
>>
>> @Field
>> private String id;
>> @Field
>> private String name;
>> @Field
>> private B myB;
>> }
>>
>> ----------
>> Class B {
>>
>> @Field("b_id")
>> private String id;
>> @Field("B_name")
>> private String name;
>> }
>>
>>
> No.
>
> I guess you want to represent certain fields in class B and have them as an
> attribute in Class A (but all fields belong to the same schema), then it can
> be a worthwhile addition to Solrj. Can you open an issue? A patch would be
> even better :)
>
> --
> Regards,
> Shalin Shekhar Mangar.
>



-- 
-----------------------------------------------------
Noble Paul | Principal Engineer| AOL | http://aol.com