Proposal for handling points using only the field lookup mechanisms
currently in place in IndexSchema:

Option A: dynamic fields used for subfields, those dynamic fields need
to be explicitly defined in the XML
============================================================================
// needed to essentially define the point type
<fieldType name="latlon" class="TrieDoubleFIeld" precisionStep="8"/>
<fieldType name="point" subFieldSuffix="_latlon" .../>
<dynamicField name="*_latlon" type="latlon" indexed="true" stored="false"/>

// uses of the point type
<field name="home" type="point"/>
<dynamicField name="*_point" type="point"/>

// subFieldSuffix is appended to the subFields indexed and thus those would be
home__0_latlon
home__1_latlon

// And the indexed fields for dynamic field work_point would be
work_point__0_latlon
work_point__1_latlon

// NOTE: this scheme works fine for subFields with different fieldTypes

Option B: dynamic fields used for subfields, dynamic fields inserted
into schema automatically
====================================================================
// needed to essentially define the point type
<fieldType name="latlon" class="TrieDoubleFIeld" precisionStep="8"/>
<fieldType name="point" subFieldType="latlon"/>

// uses of the point type
<field name="home" type="point"/>
<dynamicField name="*_point" type="point"/>

// A dynamic field is inserted into the schema by the point class of
the form __<subFieldTypeName> by default.
// This could be changed via an optional subFieldSuffix param on the
point fieldType.  double underscore used
// to minimize collisions with user-defined dynamic fields.
home_0__latlon
home_1__latlon

// And the indexed fields for dynamic field work_point would be
work_point__0__latlon
work_point__1__latlon

// NOTE: this scheme works fine for subFields with different fieldTypes


-Yonik
http://www.lucidimagination.com

Reply via email to