On Dec 24, 2009, at 12:42 PM, yo...@apache.org wrote: > Author: yonik > Date: Thu Dec 24 17:42:48 2009 > New Revision: 893792 > > URL: http://svn.apache.org/viewvc?rev=893792&view=rev > Log: > SOLR-1131: first pass at fixing support for subFieldSuffix (index + search) > > Modified: > lucene/solr/trunk/example/solr/conf/schema.xml > lucene/solr/trunk/src/java/org/apache/solr/schema/CoordinateFieldType.java > lucene/solr/trunk/src/java/org/apache/solr/schema/FieldType.java > lucene/solr/trunk/src/java/org/apache/solr/schema/PointType.java > > Modified: lucene/solr/trunk/example/solr/conf/schema.xml > URL: > http://svn.apache.org/viewvc/lucene/solr/trunk/example/solr/conf/schema.xml?rev=893792&r1=893791&r2=893792&view=diff > ============================================================================== > --- lucene/solr/trunk/example/solr/conf/schema.xml (original) > +++ lucene/solr/trunk/example/solr/conf/schema.xml Thu Dec 24 17:42:48 2009 > @@ -407,7 +407,7 @@ > The subFields are an implementation detail of the fieldType, and end > users normally should not need to know about them. > --> > - <fieldType name="location" class="solr.PointType" dimension="2" > subFieldType="double"/> > + <fieldType name="location" class="solr.PointType" dimension="2" > subFieldSuffix="_d"/> > > </types>
Shouldn't we demo both? > > > Modified: > lucene/solr/trunk/src/java/org/apache/solr/schema/CoordinateFieldType.java > URL: > http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/schema/CoordinateFieldType.java?rev=893792&r1=893791&r2=893792&view=diff > ============================================================================== > --- > lucene/solr/trunk/src/java/org/apache/solr/schema/CoordinateFieldType.java > (original) > +++ > lucene/solr/trunk/src/java/org/apache/solr/schema/CoordinateFieldType.java > Thu Dec 24 17:42:48 2009 > @@ -55,7 +55,7 @@ > protected FieldType subType; > public static final String SUB_FIELD_SUFFIX = "subFieldSuffix"; > public static final String SUB_FIELD_TYPE = "subFieldType"; > - private String suffix;//need to keep this around between init and inform, > since dynamic fields aren't created until before inform > + protected String suffix; > protected int dynFieldProps; > > public int getDimension() { > @@ -76,6 +76,7 @@ > if (subFT != null) { > args.remove(SUB_FIELD_TYPE); > subType = schema.getFieldTypeByName(subFT.trim()); > + suffix = POLY_FIELD_SEPARATOR + subType.typeName; > } else if (subSuffix != null) { > args.remove(SUB_FIELD_SUFFIX); > suffix = subSuffix; > @@ -90,18 +91,9 @@ > > public void inform(IndexSchema schema) { > //Can't do this until here b/c the Dynamic Fields are not initialized > until here. > - if (suffix != null){ > - SchemaField sf = schema.getField(suffix); > - subType = sf.getType();//this means it is already registered > - dynFieldProps = sf.getProperties(); > - } > - else if (subType != null) { > + if (subType != null) { > SchemaField proto = registerPolyFieldDynamicPrototype(schema, subType); > dynFieldProps = proto.getProperties(); > - } else { > - throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "The > field type: " + typeName > - + " must specify the " + > - SUB_FIELD_TYPE + " attribute or the " + SUB_FIELD_SUFFIX + " > attribute."); > } > } > How does this handle the suffix piece?