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 罗赛 <se...@gmail.com> on 2012/01/10 10:20:33 UTC
Question about updating index with custom field types
Hello everyone,
I have a question on how to update index using xml messages when there are
some complex custom field types in my index...like:
<fieldtype name="offer" class="com.xxx.OfferField"/>
And field offer has some attributes in it...
I've read page, http://wiki.apache.org/solr/UpdateXmlMessages and example
shows that xml should be like:
<add>
<doc>
<field name="employeeId">05991</field>
<field name="office">Bridgewater</field>
<field name="skills">Perl</field>
<field name="skills">Java</field>
</doc>
[<doc> ... </doc>[<doc> ... </doc>]]
</add>
So, could u tell me how to write the XML or is there any other method to
update index with custom field types?
Thanks,
--
Best wishes
Sai
Re: Question about updating index with custom field types
Posted by 罗赛 <se...@gmail.com>.
Hi Sylvain,
I'm very sorry that I could not help you for I'm also doing pure English
project...
Erick,
Thanks for your approach, I'll try it.
Luo Sai
On Wed, Jan 11, 2012 at 10:08 PM, Erick Erickson <er...@gmail.com>wrote:
> I'm not sure what custom field types have to do with XML here.
> Somewhere, you have to have defined a *field* in your schema.xml
> that references your custom type, something like:
> <field name="the_offer" type="offer" ..... />
>
> then the XML is just like any other field
> <doc>
> <field name="the_offer" attr1="val1">56.75</field>
> </doc>
>
> WARNING: I don't quite know how to access the attributes
> down in your special code, I haven't had the occasion
> to actually do that so I don't know whether the attributes
> are carried down through the document parsing....
>
> Best
> Erick
>
> On Tue, Jan 10, 2012 at 4:20 AM, 罗赛 <se...@gmail.com> wrote:
> > Hello everyone,
> >
> > I have a question on how to update index using xml messages when there
> are
> > some complex custom field types in my index...like:
> > <fieldtype name="offer" class="com.xxx.OfferField"/>
> > And field offer has some attributes in it...
> >
> > I've read page, http://wiki.apache.org/solr/UpdateXmlMessages and
> example
> > shows that xml should be like:
> >
> > <add>
> > <doc>
> > <field name="employeeId">05991</field>
> > <field name="office">Bridgewater</field>
> > <field name="skills">Perl</field>
> > <field name="skills">Java</field>
> > </doc>
> > [<doc> ... </doc>[<doc> ... </doc>]]
> > </add>
> >
> >
> > So, could u tell me how to write the XML or is there any other method to
> > update index with custom field types?
> >
> > Thanks,
> >
> > --
> > Best wishes
> >
> > Sai
>
--
Best wishes
罗赛
Tel 13811219876
Re: Question about updating index with custom field types
Posted by Erick Erickson <er...@gmail.com>.
I'm not sure what custom field types have to do with XML here.
Somewhere, you have to have defined a *field* in your schema.xml
that references your custom type, something like:
<field name="the_offer" type="offer" ..... />
then the XML is just like any other field
<doc>
<field name="the_offer" attr1="val1">56.75</field>
</doc>
WARNING: I don't quite know how to access the attributes
down in your special code, I haven't had the occasion
to actually do that so I don't know whether the attributes
are carried down through the document parsing....
Best
Erick
On Tue, Jan 10, 2012 at 4:20 AM, 罗赛 <se...@gmail.com> wrote:
> Hello everyone,
>
> I have a question on how to update index using xml messages when there are
> some complex custom field types in my index...like:
> <fieldtype name="offer" class="com.xxx.OfferField"/>
> And field offer has some attributes in it...
>
> I've read page, http://wiki.apache.org/solr/UpdateXmlMessages and example
> shows that xml should be like:
>
> <add>
> <doc>
> <field name="employeeId">05991</field>
> <field name="office">Bridgewater</field>
> <field name="skills">Perl</field>
> <field name="skills">Java</field>
> </doc>
> [<doc> ... </doc>[<doc> ... </doc>]]
> </add>
>
>
> So, could u tell me how to write the XML or is there any other method to
> update index with custom field types?
>
> Thanks,
>
> --
> Best wishes
>
> Sai