You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by yo...@apache.org on 2009/12/24 19:35:26 UTC
svn commit: r893801 - in /lucene/solr/trunk/src:
java/org/apache/solr/schema/IndexSchema.java
test/org/apache/solr/schema/PolyFieldTest.java
Author: yonik
Date: Thu Dec 24 18:35:25 2009
New Revision: 893801
URL: http://svn.apache.org/viewvc?rev=893801&view=rev
Log:
SOLR-1131: remove concept of polyField from IndexSchema
Modified:
lucene/solr/trunk/src/java/org/apache/solr/schema/IndexSchema.java
lucene/solr/trunk/src/test/org/apache/solr/schema/PolyFieldTest.java
Modified: lucene/solr/trunk/src/java/org/apache/solr/schema/IndexSchema.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/schema/IndexSchema.java?rev=893801&r1=893800&r2=893801&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/schema/IndexSchema.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/schema/IndexSchema.java Thu Dec 24 18:35:25 2009
@@ -180,8 +180,6 @@
@Deprecated
public String getName() { return name; }
- ;
-
/**
* Provides direct access to the Map containing all explicit
* (ie: non-dynamic) fields in the index, keyed on field name.
@@ -705,12 +703,11 @@
log.debug("dynamic field creation for schema field: " + field.getName());
addDynamicFieldNoDupCheck(dynFields, field);
} else {
- log.debug("dynamic field creation avoided: dynamic field: [" + field.getName() + "] " +
- "already defined in the schema!");
+ log.debug("dynamic field already exists: dynamic field: [" + field.getName() + "]");
}
}
Collections.sort(dynFields);
- dynamicFields = (DynamicField[]) dynFields.toArray(new DynamicField[dynFields.size()]);
+ dynamicFields = dynFields.toArray(new DynamicField[dynFields.size()]);
}
private void addDynamicFieldNoDupCheck(List<DynamicField> dFields, SchemaField f) {
@@ -719,14 +716,10 @@
}
private boolean isDuplicateDynField(List<DynamicField> dFields, SchemaField f) {
- boolean dup = false;
for( DynamicField df : dFields ) {
- if( df.regex.equals( f.name ) ) {
- dup = true;
- break;
- }
+ if( df.regex.equals( f.name ) ) return true;
}
- return dup;
+ return false;
}
public void registerCopyField( String source, String dest )
@@ -1107,7 +1100,7 @@
* Returns the SchemaField that should be used for the specified field name, or
* null if none exists.
*
- * @param fieldName may be an explicitly defined field, a PolyField, or a name that
+ * @param fieldName may be an explicitly defined field or a name that
* matches a dynamic field.
* @see #getFieldType
* @see #getField(String)
@@ -1127,7 +1120,7 @@
/**
* Returns the SchemaField that should be used for the specified field name
*
- * @param fieldName may be an explicitly defined field, a PolyField type, or a name that
+ * @param fieldName may be an explicitly defined field or a name that
* matches a dynamic field.
* @throws SolrException if no such field exists
* @see #getFieldType
@@ -1223,22 +1216,6 @@
return null;
};
- /**
- *
- * @param fieldName The name of the field
- * @return the {@link FieldType} or a {@link org.apache.solr.common.SolrException} if the field is not a poly field.
- */
- public FieldType getPolyFieldType(String fieldName){
- SchemaField f = fields.get(fieldName);
- if (f != null && f.isPolyField()) return f.getType();
- throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"undefined field or not a poly field "+fieldName);
- }
-
- public FieldType getPolyFieldTypeNoEx(String fieldName){
- SchemaField f = fields.get(fieldName);
- if (f != null && f.isPolyField()) return f.getType();
- return null;
- }
/**
* Get all copy fields, both the static and the dynamic ones.
Modified: lucene/solr/trunk/src/test/org/apache/solr/schema/PolyFieldTest.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/test/org/apache/solr/schema/PolyFieldTest.java?rev=893801&r1=893800&r2=893801&view=diff
==============================================================================
--- lucene/solr/trunk/src/test/org/apache/solr/schema/PolyFieldTest.java (original)
+++ lucene/solr/trunk/src/test/org/apache/solr/schema/PolyFieldTest.java Thu Dec 24 18:35:25 2009
@@ -73,24 +73,10 @@
assertNotNull(home);
home = schema.getField("home");
assertNotNull(home);
- homeFT = schema.getPolyFieldType("home");
- assertNotNull(homeFT);
home = schema.getField("homed");//sub field suffix
assertNotNull(home);
assertTrue(home.isPolyField());
-
- try {
- FieldType bad = schema.getPolyFieldType("foo");
- assertTrue(false);
- } catch (Exception e) {
- }
- try {
- FieldType bad = schema.getPolyFieldTypeNoEx("foo");
- assertNull(bad);
- } catch (Exception e) {
- assertTrue(false);
- }
}
public void testPointFieldType() throws Exception {