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 Eivind Hodneland <ei...@uptimeconsulting.no> on 2020/06/17 15:03:03 UTC
Java - setting multi-valued fields
Hi,
My customer has a Solr index with a large amount of fields, many of these are multivalued (type="string", multiValued="true").
I am having problems with setting the values for these fields in my Java update processors.
Example:
String[] values = new String[] {"value 1", "value 2" };
inputDoc.setField (multiFieldName, values);
However, only "value 1" is present in the index after updating.
What is the best / correct way to make this work?
Uptime Consulting | Eivind Hodneland | Senior Consultant | Munchs gate 7, NO-0165 Oslo, Norway
Tel: +47 22 33 71 00 | Mob: +47 971 76 083 | eivind.hodneland@uptimeconsulting.no<ma...@uptimeconsulting.no> | www.uptimeconsulting.no<http://www.uptimeconsulting.no/>
----------------------------------------------------------------------
Search and Big Data solutions
Software Development
IT outsourcing services and consultancy
[4180EEB7]
Re: Java - setting multi-valued fields
Posted by kumar gaurav <kg...@gmail.com>.
If this approach did not work , that means there is something wrong in Solr
schema .
Can you share a field schema ?
Regards
Kumar Gaurav
On Wed, Jun 24, 2020 at 2:29 PM Eivind Hodneland <
eivind.hodneland@uptimeconsulting.no> wrote:
> Hi,
>
> Thanks for your input.
> However, this approach did not work either, it gave the same result as
> previously.
>
> Is there perhaps a different approach that could be used, other methods
> etc. ?
>
>
> Uptime Consulting | Eivind Hodneland | Senior Consultant | Munchs gate 7,
> NO-0165 Oslo, Norway
> Tel: +47 22 33 71 00 | Mob: +47 971 76 083 |
> eivind.hodneland@uptimeconsulting.no | www.uptimeconsulting.no
> ----------------------------------------------------------------------
> Search and Big Data solutions
> Software Development
> IT outsourcing services and consultancy
>
>
>
>
>
> -----Original Message-----
> From: kumar gaurav <kg...@gmail.com>
> Sent: onsdag 17. juni 2020 19:02
> To: solr-user@lucene.apache.org
> Subject: Re: Java - setting multi-valued fields
>
> HI
>
> Example:
>
> String[] values = new String[] {“value 1”, “value 2” };
>
> inputDoc.setField (multiFieldName, values);
>
>
> Can you try once to change the array to list ?
>
> List<String> values = new ArrayList<>();
>
> values.add("value 1");
>
> values.add("value 2");
>
> inputDoc.setField (multiFieldName, values);
>
>
>
> regards
>
> Kumar Gaurav
>
>
>
>
>
>
>
> On Wed, Jun 17, 2020 at 8:33 PM Eivind Hodneland <
> eivind.hodneland@uptimeconsulting.no> wrote:
>
> > Hi,
> >
> >
> >
> > My customer has a Solr index with a large amount of fields, many of
> > these are multivalued (type=”string”, multiValued=”true”).
> >
> >
> >
> > I am having problems with setting the values for these fields in my
> > Java update processors.
> >
> > Example:
> >
> > String[] values = new String[] {“value 1”, “value 2” };
> >
> > inputDoc.setField (multiFieldName, values);
> >
> >
> >
> > However, only “value 1” is present in the index after updating.
> >
> > What is the best / correct way to make this work?
> >
> >
> >
> >
> >
> >
> >
> > Uptime Consulting | Eivind Hodneland | Senior Consultant | Munchs gate
> > 7,
> > NO-0165 Oslo, Norway
> >
> > Tel: +47 22 33 71 00 | Mob: +47 971 76 083 |
> > eivind.hodneland@uptimeconsulting.no | www.uptimeconsulting.no
> >
> > ----------------------------------------------------------------------
> >
> > Search and Big Data solutions
> >
> > Software Development
> >
> > IT outsourcing services and consultancy
> >
> >
> >
> > [image: 4180EEB7]
> >
> >
> >
>
RE: Java - setting multi-valued fields
Posted by Eivind Hodneland <ei...@uptimeconsulting.no>.
Hi,
Thanks for your input.
However, this approach did not work either, it gave the same result as previously.
Is there perhaps a different approach that could be used, other methods etc. ?
Uptime Consulting | Eivind Hodneland | Senior Consultant | Munchs gate 7, NO-0165 Oslo, Norway
Tel: +47 22 33 71 00 | Mob: +47 971 76 083 | eivind.hodneland@uptimeconsulting.no | www.uptimeconsulting.no
----------------------------------------------------------------------
Search and Big Data solutions
Software Development
IT outsourcing services and consultancy
-----Original Message-----
From: kumar gaurav <kg...@gmail.com>
Sent: onsdag 17. juni 2020 19:02
To: solr-user@lucene.apache.org
Subject: Re: Java - setting multi-valued fields
HI
Example:
String[] values = new String[] {“value 1”, “value 2” };
inputDoc.setField (multiFieldName, values);
Can you try once to change the array to list ?
List<String> values = new ArrayList<>();
values.add("value 1");
values.add("value 2");
inputDoc.setField (multiFieldName, values);
regards
Kumar Gaurav
On Wed, Jun 17, 2020 at 8:33 PM Eivind Hodneland < eivind.hodneland@uptimeconsulting.no> wrote:
> Hi,
>
>
>
> My customer has a Solr index with a large amount of fields, many of
> these are multivalued (type=”string”, multiValued=”true”).
>
>
>
> I am having problems with setting the values for these fields in my
> Java update processors.
>
> Example:
>
> String[] values = new String[] {“value 1”, “value 2” };
>
> inputDoc.setField (multiFieldName, values);
>
>
>
> However, only “value 1” is present in the index after updating.
>
> What is the best / correct way to make this work?
>
>
>
>
>
>
>
> Uptime Consulting | Eivind Hodneland | Senior Consultant | Munchs gate
> 7,
> NO-0165 Oslo, Norway
>
> Tel: +47 22 33 71 00 | Mob: +47 971 76 083 |
> eivind.hodneland@uptimeconsulting.no | www.uptimeconsulting.no
>
> ----------------------------------------------------------------------
>
> Search and Big Data solutions
>
> Software Development
>
> IT outsourcing services and consultancy
>
>
>
> [image: 4180EEB7]
>
>
>
Re: Java - setting multi-valued fields
Posted by kumar gaurav <kg...@gmail.com>.
HI
Example:
String[] values = new String[] {“value 1”, “value 2” };
inputDoc.setField (multiFieldName, values);
Can you try once to change the array to list ?
List<String> values = new ArrayList<>();
values.add("value 1");
values.add("value 2");
inputDoc.setField (multiFieldName, values);
regards
Kumar Gaurav
On Wed, Jun 17, 2020 at 8:33 PM Eivind Hodneland <
eivind.hodneland@uptimeconsulting.no> wrote:
> Hi,
>
>
>
> My customer has a Solr index with a large amount of fields, many of these
> are multivalued (type=”string”, multiValued=”true”).
>
>
>
> I am having problems with setting the values for these fields in my Java
> update processors.
>
> Example:
>
> String[] values = new String[] {“value 1”, “value 2” };
>
> inputDoc.setField (multiFieldName, values);
>
>
>
> However, only “value 1” is present in the index after updating.
>
> What is the best / correct way to make this work?
>
>
>
>
>
>
>
> Uptime Consulting | Eivind Hodneland | Senior Consultant | Munchs gate 7,
> NO-0165 Oslo, Norway
>
> Tel: +47 22 33 71 00 | Mob: +47 971 76 083 |
> eivind.hodneland@uptimeconsulting.no | www.uptimeconsulting.no
>
> ----------------------------------------------------------------------
>
> Search and Big Data solutions
>
> Software Development
>
> IT outsourcing services and consultancy
>
>
>
> [image: 4180EEB7]
>
>
>