예제 #1
0
 public ObjectMapper putMapper(Mapper mapper) {
   if (mapper instanceof AllFieldMapper.IncludeInAll) {
     ((AllFieldMapper.IncludeInAll) mapper).includeInAllIfNotSet(includeInAll);
   }
   synchronized (mutex) {
     mappers = mappers.copyAndPut(mapper.name(), mapper);
   }
   return this;
 }
예제 #2
0
 /** Return a new instance that contains the union of this and of the provided analyzers. */
 public FieldNameAnalyzer copyAndAddAll(
     Collection<? extends Map.Entry<String, Analyzer>> mappers) {
   CopyOnWriteHashMap<String, Analyzer> analyzers = this.analyzers;
   for (Map.Entry<String, Analyzer> entry : mappers) {
     Analyzer analyzer = entry.getValue();
     if (analyzer == null) {
       analyzer = defaultAnalyzer;
     }
     analyzers = analyzers.copyAndPut(entry.getKey(), analyzer);
   }
   return new FieldNameAnalyzer(analyzers, defaultAnalyzer);
 }
예제 #3
0
 /**
  * Put a new mapper. NOTE: this method must be called under the current {@link DocumentMapper}
  * lock if concurrent updates are expected.
  */
 public void putMapper(Mapper mapper) {
   if (mapper instanceof AllFieldMapper.IncludeInAll) {
     ((AllFieldMapper.IncludeInAll) mapper).includeInAllIfNotSet(includeInAll);
   }
   mappers = mappers.copyAndPut(mapper.simpleName(), mapper);
 }