Multivalued fields via Java API


(Frank LaRosa) #1

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.


(Shay Banon) #2

Yes, a List of values will do.

On Mon, Jan 9, 2012 at 10:44 PM, Frank LaRosa frank@studyblue.com 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.


(Ivan Brusic) #3

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 kimchy@gmail.com wrote:

Yes, a List of values will do.

On Mon, Jan 9, 2012 at 10:44 PM, Frank LaRosa frank@studyblue.com 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.


(Shay Banon) #4

I told you to open an issue... :slight_smile:

On Tue, Jan 10, 2012 at 2:01 AM, Ivan Brusic ivan@brusic.com 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 kimchy@gmail.com wrote:

Yes, a List of values will do.

On Mon, Jan 9, 2012 at 10:44 PM, Frank LaRosa frank@studyblue.com
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.


(system) #5