예제 #1
0
 /**
  * Returns all the fields that match the given pattern. If the pattern is prefixed with a type
  * then the fields will be returned with a type prefix.
  */
 public Set<String> simpleMatchToIndexNames(String pattern) {
   if (!Regex.isSimpleMatchPattern(pattern)) {
     return ImmutableSet.of(pattern);
   }
   int dotIndex = pattern.indexOf('.');
   if (dotIndex != -1) {
     String possibleType = pattern.substring(0, dotIndex);
     DocumentMapper possibleDocMapper = mappers.get(possibleType);
     if (possibleDocMapper != null) {
       Set<String> typedFields = Sets.newHashSet();
       for (String indexName : possibleDocMapper.mappers().simpleMatchToIndexNames(pattern)) {
         typedFields.add(possibleType + "." + indexName);
       }
       return typedFields;
     }
   }
   return fieldMappers.simpleMatchToIndexNames(pattern);
 }
예제 #2
0
  private void removeObjectAndFieldMappers(DocumentMapper docMapper) {
    synchronized (mappersMutex) {
      fieldMappers.removeMappers(docMapper.mappers());

      ImmutableOpenMap.Builder<String, ObjectMappers> fullPathObjectMappers =
          ImmutableOpenMap.builder(this.fullPathObjectMappers);
      for (ObjectMapper mapper : docMapper.objectMappers().values()) {
        ObjectMappers mappers = fullPathObjectMappers.get(mapper.fullPath());
        if (mappers != null) {
          mappers = mappers.remove(mapper);
          if (mappers.isEmpty()) {
            fullPathObjectMappers.remove(mapper.fullPath());
          } else {
            fullPathObjectMappers.put(mapper.fullPath(), mappers);
          }
        }
      }

      this.fullPathObjectMappers = fullPathObjectMappers.build();
    }
  }
예제 #3
0
 /**
  * Returns the {@link FieldMappers} of all the {@link FieldMapper}s that are registered under the
  * give fullName across all the different {@link DocumentMapper} types.
  *
  * @param fullName The full name
  * @return All teh {@link FieldMappers} across all the {@link DocumentMapper}s for the given
  *     fullName.
  */
 public FieldMappers fullName(String fullName) {
   return fieldMappers.fullName(fullName);
 }
예제 #4
0
 /**
  * Returns {@link FieldMappers} for all the {@link FieldMapper}s that are registered under the
  * given indexName across all the different {@link DocumentMapper} types.
  *
  * @param indexName The indexName to return all the {@link FieldMappers} for across all {@link
  *     DocumentMapper}s.
  * @return All the {@link FieldMappers} across all {@link DocumentMapper}s for the given
  *     indexName.
  */
 public FieldMappers indexName(String indexName) {
   return fieldMappers.indexName(indexName);
 }
예제 #5
0
 /**
  * Returns {@link FieldMappers} for all the {@link FieldMapper}s that are registered under the
  * given name across all the different {@link DocumentMapper} types.
  *
  * @param name The name to return all the {@link FieldMappers} for across all {@link
  *     DocumentMapper}s.
  * @return All the {@link FieldMappers} for across all {@link DocumentMapper}s
  */
 public FieldMappers name(String name) {
   return fieldMappers.name(name);
 }