Multivalued fields via Java API

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

Multivalued fields via Java API

Frank LaRosa
Hi,

I have an integer field in my index which I would like to be
multivalued.

I am using the Java API, and I prefer to use
the .setSource(Map<String,Object>) method of setting the source.

In the case of a multivalued field, what object should I pass? Will a
List or Set of Integers work, or is it expecting an Array?

What kind of a collection should I expect when reading back one of
these documents? Is it correct to assume that instances with one value
will be returned as an Integer while instances with multiple values
will be returned as some kind of a collection or array?

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Multivalued fields via Java API

kimchy
Administrator
Yes, a List of values will do.

On Mon, Jan 9, 2012 at 10:44 PM, Frank LaRosa <[hidden email]> wrote:
Hi,

I have an integer field in my index which I would like to be
multivalued.

I am using the Java API, and I prefer to use
the .setSource(Map<String,Object>) method of setting the source.

In the case of a multivalued field, what object should I pass? Will a
List or Set of Integers work, or is it expecting an Array?

What kind of a collection should I expect when reading back one of
these documents? Is it correct to assume that instances with one value
will be returned as an Integer while instances with multiple values
will be returned as some kind of a collection or array?

Thanks.

Reply | Threaded
Open this post in threaded view
|

Re: Multivalued fields via Java API

Ivan Brusic
It is interesting to see that there is now support for Iterable. In
the past, you told me the limitation was because of JSON, which I did
not understand at the time. Then I understood that the idea was to
have the REST API identical to the Java API in terms of types
supported.

On Mon, Jan 9, 2012 at 1:08 PM, Shay Banon <[hidden email]> wrote:

> Yes, a List of values will do.
>
>
> On Mon, Jan 9, 2012 at 10:44 PM, Frank LaRosa <[hidden email]> wrote:
>>
>> Hi,
>>
>> I have an integer field in my index which I would like to be
>> multivalued.
>>
>> I am using the Java API, and I prefer to use
>> the .setSource(Map<String,Object>) method of setting the source.
>>
>> In the case of a multivalued field, what object should I pass? Will a
>> List or Set of Integers work, or is it expecting an Array?
>>
>> What kind of a collection should I expect when reading back one of
>> these documents? Is it correct to assume that instances with one value
>> will be returned as an Integer while instances with multiple values
>> will be returned as some kind of a collection or array?
>>
>> Thanks.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Multivalued fields via Java API

kimchy
Administrator
I told you to open an issue... :)

On Tue, Jan 10, 2012 at 2:01 AM, Ivan Brusic <[hidden email]> wrote:
It is interesting to see that there is now support for Iterable. In
the past, you told me the limitation was because of JSON, which I did
not understand at the time. Then I understood that the idea was to
have the REST API identical to the Java API in terms of types
supported.

On Mon, Jan 9, 2012 at 1:08 PM, Shay Banon <[hidden email]> wrote:
> Yes, a List of values will do.
>
>
> On Mon, Jan 9, 2012 at 10:44 PM, Frank LaRosa <[hidden email]> wrote:
>>
>> Hi,
>>
>> I have an integer field in my index which I would like to be
>> multivalued.
>>
>> I am using the Java API, and I prefer to use
>> the .setSource(Map<String,Object>) method of setting the source.
>>
>> In the case of a multivalued field, what object should I pass? Will a
>> List or Set of Integers work, or is it expecting an Array?
>>
>> What kind of a collection should I expect when reading back one of
>> these documents? Is it correct to assume that instances with one value
>> will be returned as an Integer while instances with multiple values
>> will be returned as some kind of a collection or array?
>>
>> Thanks.
>
>