Package org.apache.solr.schema

Examples of org.apache.solr.schema.SchemaField.multiValued()


      fval = vals[0];
      vals = null;
    }

    // single valued field with multiple values... catenate them.
    if (sf != null && !sf.multiValued() && vals != null) {
      StringBuilder builder = new StringBuilder();
      boolean first=true;
      for (String val : vals) {
        if (first) {
          first=false;
View Full Code Here


        if (sf.isRequired()) {
          LOG
                  .info(sf.getName()
                          + " is a required field in SolrSchema . But not found in DataConfig");
        }
        autoFields.add(new DataConfig.Field(sf.getName(), sf.multiValued()));
      }
    }
    for (Map.Entry<String, DataConfig.Field> entry : fields.entrySet()) {
      DataConfig.Field fld = entry.getValue();
      FieldType fieldType = null;
View Full Code Here

    if (e.fields != null) {
      for (DataConfig.Field f : e.fields) {
        f.nameOrColName = f.getName();
        SchemaField schemaField = schema.getFields().get(f.getName());
        if (schemaField != null) {
          f.multiValued = schemaField.multiValued();
          f.allAttributes.put(MULTI_VALUED, Boolean.toString(schemaField
                  .multiValued()));
          f.allAttributes.put(TYPE, schemaField.getType().getTypeName());
          f.allAttributes.put("indexed", Boolean
                  .toString(schemaField.indexed()));
View Full Code Here

      for (DataConfig.Field f : e.fields) {
        f.nameOrColName = f.getName();
        SchemaField schemaField = schema.getFields().get(f.getName());
        if (schemaField != null) {
          f.multiValued = schemaField.multiValued();
          f.allAttributes.put(MULTI_VALUED, Boolean.toString(schemaField
                  .multiValued()));
          f.allAttributes.put(TYPE, schemaField.getType().getTypeName());
          f.allAttributes.put("indexed", Boolean
                  .toString(schemaField.indexed()));
          f.allAttributes.put("stored", Boolean.toString(schemaField.stored()));
View Full Code Here

      SchemaField sfield = schema.getFieldOrNull(name);
      boolean used = false;
      float boost = field.getBoost();
     
      // Make sure it has the correct number
      if( sfield!=null && !sfield.multiValued() && field.getValueCount() > 1 ) {
        String id = "";
        SchemaField sf = schema.getUniqueKeyField();
        if( sf != null ) {
          id = "["+doc.getFieldValue( sf.getName() )+"] ";
        }
View Full Code Here

        }
       
        // Add the copy fields
        for( SchemaField sf : destArr ) {
          // check if the copy field is a multivalued or not
          if( !sf.multiValued() && out.get( sf.getName() ) != null ) {
            throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,
                "ERROR: multiple values encountered for non multiValued copy field " +
                  sf.getName() + ": " +val );
          }
         
View Full Code Here

          if (schemaField == null) {
            schemaField = config.lowerNameVsSchemaField.get(f.getName().toLowerCase());
            if (schemaField != null) f.name = schemaField.getName();
          }
          if (schemaField != null) {
            f.multiValued = schemaField.multiValued();
            f.allAttributes.put(MULTI_VALUED, Boolean.toString(schemaField
                    .multiValued()));
            f.allAttributes.put(TYPE, schemaField.getType().getTypeName());
            f.allAttributes.put("indexed", Boolean.toString(schemaField.indexed()));
            f.allAttributes.put("stored", Boolean.toString(schemaField.stored()));
View Full Code Here

            schemaField = config.lowerNameVsSchemaField.get(f.getName().toLowerCase());
            if (schemaField != null) f.name = schemaField.getName();
          }
          if (schemaField != null) {
            f.multiValued = schemaField.multiValued();
            f.allAttributes.put(MULTI_VALUED, Boolean.toString(schemaField
                    .multiValued()));
            f.allAttributes.put(TYPE, schemaField.getType().getTypeName());
            f.allAttributes.put("indexed", Boolean.toString(schemaField.indexed()));
            f.allAttributes.put("stored", Boolean.toString(schemaField.stored()));
            f.allAttributes.put("defaultValue", schemaField.getDefaultValue());
View Full Code Here

      }

      // if the field is multivalued, it may have other values further on... so
      // build up a list for each multi-valued field.
      SchemaField sf = schema.getField(fname);
      if (sf.multiValued()) {
        MultiValueField mf = multi.get(fname);
        if (mf==null) {
          mf = new MultiValueField(sf, ff);
          multi.put(fname, mf);
        } else {
View Full Code Here

      if (val instanceof Collection) {
        writeVal(fname, val);
      } else {
        // if multivalued field, write single value as an array
        SchemaField sf = schema.getFieldOrNull(fname);
        if (sf != null && sf.multiValued()) {
          writeArrayOpener(-1); // no trivial way to determine array size
          writeVal(fname, val);
          writeArrayCloser();
        } else {
          writeVal(fname, val);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.