Ejemplo n.º 1
0
 /**
  * Same as {@link #smartNameFieldMappers(String)} but returns the first field mapper for it.
  * Returns <tt>null</tt> if there is none.
  */
 public FieldMapper smartNameFieldMapper(String smartName) {
   FieldMappers fieldMappers = smartNameFieldMappers(smartName);
   if (fieldMappers != null) {
     return fieldMappers.mapper();
   }
   return null;
 }
Ejemplo n.º 2
0
 public FieldMapper smartNameFieldMapper(String smartName, @Nullable String[] types) {
   FieldMappers fieldMappers = smartNameFieldMappers(smartName, types);
   if (fieldMappers != null) {
     return fieldMappers.mapper();
   }
   return null;
 }
Ejemplo n.º 3
0
    @Override
    protected Analyzer getWrappedAnalyzer(String fieldName) {
      int dotIndex = fieldName.indexOf('.');
      if (dotIndex != -1) {
        String possibleType = fieldName.substring(0, dotIndex);
        DocumentMapper possibleDocMapper = mappers.get(possibleType);
        if (possibleDocMapper != null) {
          return possibleDocMapper.mappers().searchQuoteAnalyzer();
        }
      }
      FieldMappers mappers = fieldMappers.fullName(fieldName);
      if (mappers != null
          && mappers.mapper() != null
          && mappers.mapper().searchQuoteAnalyzer() != null) {
        return mappers.mapper().searchQuoteAnalyzer();
      }

      mappers = fieldMappers.indexName(fieldName);
      if (mappers != null
          && mappers.mapper() != null
          && mappers.mapper().searchQuoteAnalyzer() != null) {
        return mappers.mapper().searchQuoteAnalyzer();
      }
      return defaultAnalyzer;
    }
Ejemplo n.º 4
0
 /** The first mapper for the smart named field. */
 public FieldMapper mapper() {
   return fieldMappers.mapper();
 }
Ejemplo n.º 5
0
 /** Has at least one mapper for the field. */
 public boolean hasMapper() {
   return !fieldMappers.isEmpty();
 }