Ejemplo n.º 1
0
  /**
   * Create a new instance configured with the provided FieldType options. See {@link
   * #DEFAULT_FIELDTYPE}. a field type is used to articulate the desired options (namely
   * pointValues, docValues, stored). Legacy numerics is configurable this way too.
   */
  public PointVectorStrategy(SpatialContext ctx, String fieldNamePrefix, FieldType fieldType) {
    super(ctx, fieldNamePrefix);
    this.fieldNameX = fieldNamePrefix + SUFFIX_X;
    this.fieldNameY = fieldNamePrefix + SUFFIX_Y;

    int numPairs = 0;
    if ((this.hasStored = fieldType.stored())) {
      numPairs++;
    }
    if ((this.hasDocVals = fieldType.docValuesType() != DocValuesType.NONE)) {
      numPairs++;
    }
    if ((this.hasPointVals = fieldType.pointDimensionCount() > 0)) {
      numPairs++;
    }
    if (fieldType.indexOptions() != IndexOptions.NONE && fieldType.numericType() != null) {
      if (hasPointVals) {
        throw new IllegalArgumentException(
            "pointValues and LegacyNumericType are mutually exclusive");
      }
      if (fieldType.numericType() != FieldType.LegacyNumericType.DOUBLE) {
        throw new IllegalArgumentException(
            getClass() + " does not support " + fieldType.numericType());
      }
      numPairs++;
      legacyNumericFieldType = new FieldType(LegacyDoubleField.TYPE_NOT_STORED);
      legacyNumericFieldType.setNumericPrecisionStep(fieldType.numericPrecisionStep());
      legacyNumericFieldType.freeze();
    } else {
      legacyNumericFieldType = null;
    }
    this.fieldsLen = numPairs * 2;
  }
 /** Create a new mutable FieldType with all of the properties from <code>ref</code> */
 public FieldType(FieldType ref) {
   this.indexed = ref.indexed();
   this.stored = ref.stored();
   this.tokenized = ref.tokenized();
   this.storeTermVectors = ref.storeTermVectors();
   this.storeTermVectorOffsets = ref.storeTermVectorOffsets();
   this.storeTermVectorPositions = ref.storeTermVectorPositions();
   this.storeTermVectorPayloads = ref.storeTermVectorPayloads();
   this.omitNorms = ref.omitNorms();
   this.indexOptions = ref.indexOptions();
   this.docValueType = ref.docValueType();
   this.numericType = ref.numericType();
   // Do not copy frozen!
 }
Ejemplo n.º 3
0
 protected StringFieldMapper(
     Names names,
     float boost,
     FieldType fieldType,
     FieldType defaultFieldType,
     Boolean docValues,
     String nullValue,
     NamedAnalyzer indexAnalyzer,
     NamedAnalyzer searchAnalyzer,
     NamedAnalyzer searchQuotedAnalyzer,
     int positionOffsetGap,
     int ignoreAbove,
     SimilarityProvider similarity,
     Loading normsLoading,
     @Nullable Settings fieldDataSettings,
     Settings indexSettings,
     MultiFields multiFields,
     CopyTo copyTo) {
   super(
       names,
       boost,
       fieldType,
       docValues,
       indexAnalyzer,
       searchAnalyzer,
       similarity,
       normsLoading,
       fieldDataSettings,
       indexSettings,
       multiFields,
       copyTo);
   if (fieldType.tokenized() && fieldType.indexOptions() != IndexOptions.NONE && hasDocValues()) {
     throw new MapperParsingException(
         "Field [" + names.fullName() + "] cannot be analyzed and have doc values");
   }
   this.defaultFieldType = defaultFieldType;
   this.nullValue = nullValue;
   this.positionOffsetGap = positionOffsetGap;
   this.searchQuotedAnalyzer =
       searchQuotedAnalyzer != null ? searchQuotedAnalyzer : this.searchAnalyzer;
   this.ignoreAbove = ignoreAbove;
 }