示例#1
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;
    }
示例#2
0
 public FieldMapper smartNameFieldMapper(String smartName, @Nullable String[] types) {
   FieldMappers fieldMappers = smartNameFieldMappers(smartName, types);
   if (fieldMappers != null) {
     return fieldMappers.mapper();
   }
   return null;
 }
示例#3
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;
 }
示例#4
0
 /** The first mapper for the smart named field. */
 public FieldMapper mapper() {
   return fieldMappers.mapper();
 }