|
@@ -22,14 +22,16 @@ package org.elasticsearch.index.mapper.core;
|
|
|
import com.carrotsearch.hppc.ObjectOpenHashSet;
|
|
|
import com.carrotsearch.hppc.cursors.ObjectCursor;
|
|
|
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
|
|
|
+import com.google.common.base.Function;
|
|
|
import com.google.common.base.Objects;
|
|
|
import com.google.common.collect.ImmutableList;
|
|
|
-
|
|
|
+import com.google.common.collect.Iterators;
|
|
|
import org.apache.lucene.analysis.Analyzer;
|
|
|
import org.apache.lucene.document.Field;
|
|
|
import org.apache.lucene.document.FieldType;
|
|
|
import org.apache.lucene.index.IndexOptions;
|
|
|
import org.apache.lucene.index.Term;
|
|
|
+import org.apache.lucene.index.Terms;
|
|
|
import org.apache.lucene.queries.TermsQuery;
|
|
|
import org.apache.lucene.search.Filter;
|
|
|
import org.apache.lucene.search.FuzzyQuery;
|
|
@@ -40,7 +42,6 @@ import org.apache.lucene.search.QueryWrapperFilter;
|
|
|
import org.apache.lucene.search.RegexpQuery;
|
|
|
import org.apache.lucene.search.TermQuery;
|
|
|
import org.apache.lucene.search.TermRangeQuery;
|
|
|
-import org.apache.lucene.index.Terms;
|
|
|
import org.apache.lucene.util.BytesRef;
|
|
|
import org.elasticsearch.Version;
|
|
|
import org.elasticsearch.action.fieldstats.FieldStats;
|
|
@@ -55,11 +56,14 @@ import org.elasticsearch.common.unit.Fuzziness;
|
|
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
|
|
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
|
|
import org.elasticsearch.index.fielddata.FieldDataType;
|
|
|
-import org.elasticsearch.index.mapper.*;
|
|
|
-import org.elasticsearch.index.mapper.ParseContext.Document;
|
|
|
+import org.elasticsearch.index.mapper.ContentPath;
|
|
|
+import org.elasticsearch.index.mapper.FieldMapper;
|
|
|
+import org.elasticsearch.index.mapper.Mapper;
|
|
|
+import org.elasticsearch.index.mapper.MapperParsingException;
|
|
|
+import org.elasticsearch.index.mapper.MergeMappingException;
|
|
|
+import org.elasticsearch.index.mapper.MergeResult;
|
|
|
+import org.elasticsearch.index.mapper.ParseContext;
|
|
|
import org.elasticsearch.index.mapper.internal.AllFieldMapper;
|
|
|
-import org.elasticsearch.index.mapper.object.ObjectMapper;
|
|
|
-import org.elasticsearch.index.mapper.object.RootObjectMapper;
|
|
|
import org.elasticsearch.index.query.QueryParseContext;
|
|
|
import org.elasticsearch.index.search.FieldDataTermsFilter;
|
|
|
import org.elasticsearch.index.similarity.SimilarityLookupService;
|
|
@@ -68,7 +72,9 @@ import org.elasticsearch.index.similarity.SimilarityProvider;
|
|
|
import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.Collections;
|
|
|
import java.util.Comparator;
|
|
|
+import java.util.Iterator;
|
|
|
import java.util.List;
|
|
|
import java.util.Locale;
|
|
|
import java.util.TreeMap;
|
|
@@ -444,15 +450,11 @@ public abstract class AbstractFieldMapper<T> implements FieldMapper<T> {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void traverse(FieldMapperListener fieldMapperListener) {
|
|
|
- fieldMapperListener.fieldMapper(this);
|
|
|
- multiFields.traverse(fieldMapperListener);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void traverse(ObjectMapperListener objectMapperListener) {
|
|
|
- // nothing to do here...
|
|
|
+ public Iterator<Mapper> iterator() {
|
|
|
+ if (multiFields == null) {
|
|
|
+ return Collections.emptyIterator();
|
|
|
+ }
|
|
|
+ return multiFields.iterator();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -955,10 +957,13 @@ public abstract class AbstractFieldMapper<T> implements FieldMapper<T> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void traverse(FieldMapperListener fieldMapperListener) {
|
|
|
- for (ObjectCursor<FieldMapper> cursor : mappers.values()) {
|
|
|
- cursor.value.traverse(fieldMapperListener);
|
|
|
- }
|
|
|
+ public Iterator<Mapper> iterator() {
|
|
|
+ return Iterators.transform(mappers.values().iterator(), new Function<ObjectCursor<FieldMapper>, Mapper>() {
|
|
|
+ @Override
|
|
|
+ public Mapper apply(@Nullable ObjectCursor<FieldMapper> cursor) {
|
|
|
+ return cursor.value;
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
public void close() {
|