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 kun xiong <xi...@gmail.com> on 2011/03/31 11:39:11 UTC
How could I set multi-value for a field in DataImporter
Since the interface of DataImporter return a Map, I can't put multi value
for a same field, right?
Example:
I write a class extending DataImporter, and want to index {"value1",
"value2"} for field "name".
How should I do?
Many thanks.
Kun
Re: How could I set multi-value for a field in DataImporter
Posted by kun xiong <xi...@gmail.com>.
I found the answer from source code.
Using a Collection as value.
Thanks any way
2011/4/1 kun xiong <xi...@gmail.com>
> Stefan,
>
> Thanks very much for your quick reply.
>
> Actually I have to write a CustomDataImporter class to full-import data and
> index them all.
>
> So it should be done in java code and schema.xml.
>
> When I write a CustomDataImporter, I have to implement a nextRow() method,
> which return a map<String,Object>. And also schema,xml have a multiValued
> label for each field.
>
> I am wondering how could I utilize it.
>
> I believe there must be several ways to make it multi-valued, using
> analyzer or copyField. I am finding a efficient and easiest way that I don't
> have to change data format.
>
> Kun
>
> 2011/3/31 Stefan Matheis <ma...@googlemail.com>
>
>> Kun,
>>
>> it should be enough to use the same field second time, like this:
>> <field name="foo>"value1</field>
>> <field name="foo">value2</field>
>>
>> Regards
>> Stefan
>>
>> On Thu, Mar 31, 2011 at 11:39 AM, kun xiong <xi...@gmail.com> wrote:
>> > Since the interface of DataImporter return a Map, I can't put multi
>> value
>> > for a same field, right?
>> >
>> > Example:
>> >
>> > I write a class extending DataImporter, and want to index {"value1",
>> > "value2"} for field "name".
>> >
>> > How should I do?
>> >
>> > Many thanks.
>> >
>> > Kun
>> >
>>
>
>
Re: How could I set multi-value for a field in DataImporter
Posted by kun xiong <xi...@gmail.com>.
Stefan,
Thanks very much for your quick reply.
Actually I have to write a CustomDataImporter class to full-import data and
index them all.
So it should be done in java code and schema.xml.
When I write a CustomDataImporter, I have to implement a nextRow() method,
which return a map<String,Object>. And also schema,xml have a multiValued
label for each field.
I am wondering how could I utilize it.
I believe there must be several ways to make it multi-valued, using analyzer
or copyField. I am finding a efficient and easiest way that I don't have to
change data format.
Kun
2011/3/31 Stefan Matheis <ma...@googlemail.com>
> Kun,
>
> it should be enough to use the same field second time, like this:
> <field name="foo>"value1</field>
> <field name="foo">value2</field>
>
> Regards
> Stefan
>
> On Thu, Mar 31, 2011 at 11:39 AM, kun xiong <xi...@gmail.com> wrote:
> > Since the interface of DataImporter return a Map, I can't put multi value
> > for a same field, right?
> >
> > Example:
> >
> > I write a class extending DataImporter, and want to index {"value1",
> > "value2"} for field "name".
> >
> > How should I do?
> >
> > Many thanks.
> >
> > Kun
> >
>
Re: How could I set multi-value for a field in DataImporter
Posted by Stefan Matheis <ma...@googlemail.com>.
Kun,
it should be enough to use the same field second time, like this:
<field name="foo>"value1</field>
<field name="foo">value2</field>
Regards
Stefan
On Thu, Mar 31, 2011 at 11:39 AM, kun xiong <xi...@gmail.com> wrote:
> Since the interface of DataImporter return a Map, I can't put multi value
> for a same field, right?
>
> Example:
>
> I write a class extending DataImporter, and want to index {"value1",
> "value2"} for field "name".
>
> How should I do?
>
> Many thanks.
>
> Kun
>