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 Venkatraman S <ve...@gmail.com> on 2007/09/14 10:35:08 UTC
SolrSchema Fields Dynamically
Hi,
I am new to Solr and am t
--
Blog @ http://blizzardzblogs.blogspot.com
Re: SolrSchema Fields Dynamically
Posted by Ed Summers <eh...@pobox.com>.
You might find the dynamic fields useful. From the schema.xml:
<!-- Dynamic field definitions. If a field name is not found, dynamicFields
will be used if the name matches any of the patterns.
RESTRICTION: the glob-like pattern in the name attribute must have
a "*" only at the start or the end.
EXAMPLE: name="*_i" will match any field ending in _i (like
myid_i, z_i)
Longer patterns will be matched first. if equal size patterns
both match, the first appearing in the schema will be used. -->
<dynamicField name="*_i" type="sint" indexed="true" stored="true"/>
<dynamicField name="*_s" type="string" indexed="true" stored="true"/>
<dynamicField name="*_l" type="slong" indexed="true" stored="true"/>
<dynamicField name="*_t" type="text" indexed="true" stored="true"
multiValued="true" />
<dynamicField name="*_b" type="boolean" indexed="true" stored="true"/>
<dynamicField name="*_f" type="sfloat" indexed="true" stored="true"/>
<dynamicField name="*_d" type="sdouble" indexed="true" stored="true"/>
<dynamicField name="*_dt" type="date" indexed="true" stored="true"/>
So you could have a document like:
<doc>
<field name="name_t">Ed Summers</field>
<field name="employer_t">Library of Congress</field>
</doc>
without having to explicitly name these fields in the schema.xml. Does
that help at all?
//Ed
SolrSchema Fields Dynamically
Posted by Venkatraman S <ve...@gmail.com>.
Hi,
I am new to Solr and am trying to implementing a solution for indexing and
searching using Embedded Solr.
However, i have a query w.r.t SolrSchema :
How do i generate the schema fields programatically, instead of defining
them in the schema.xml ?
Regards,
Venkat
[apologies for sending a WIP email in my last post]