private static boolean parseOneValue(FieldDef fd,JsonParser p,Document doc) throws IOException {
  Object o=null;
  float boost=1.0f;
  JsonToken token=p.nextToken();
  if (token == JsonToken.START_ARRAY) {
    if ("hierarchy".equals(fd.faceted) || fd.valueType == FieldDef.FieldValueType.LAT_LON) {
      o=getNativeValue(fd,token,p);
    }
 else {
      if (fd.multiValued == false) {
        fail(fd.name,"expected single value, not array, since this field is not multiValued");
      }
      while (true) {
        if (!parseOneValue(fd,p,doc)) {
          break;
        }
      }
      return true;
    }
  }
 else {
    if (token == JsonToken.END_ARRAY) {
      assert fd.multiValued;
      return false;
    }
    if (fd.fieldType.indexOptions() != IndexOptions.NONE && token == JsonToken.START_OBJECT) {
      while (true) {
        token=p.nextToken();
        if (token == JsonToken.END_OBJECT) {
          break;
        }
        assert token == JsonToken.FIELD_NAME;
        String key=p.getText();
        if (key.equals("boost")) {
          token=p.nextToken();
          if (token == JsonToken.VALUE_NUMBER_INT || token == JsonToken.VALUE_NUMBER_FLOAT) {
            boost=p.getFloatValue();
          }
 else {
            fail(fd.name,"boost in inner object field value must have float or int value; got: " + token);
          }
        }
 else         if (key.equals("value")) {
          o=getNativeValue(fd,p.nextToken(),p);
        }
 else {
          fail(fd.name,"unrecognized json key \"" + key + "\" in inner object field value; must be boost or value");
        }
      }
      if (o == null) {
        fail(fd.name,"missing 'value' key");
      }
    }
 else {
      o=getNativeValue(fd,token,p);
    }
  }
  parseOneNativeValue(fd,doc,o,boost);
  return true;
}

private static boolean parseOneValue ( FieldDef fd , JsonParser p , Document doc ) throws IOException { Object o = null ; float boost = 1.0f ; JsonToken token = p . nextToken ( ) ; if ( token == JsonToken . START_ARRAY ) { if ( "hierarchy" . equals ( fd . faceted ) || fd . valueType == FieldDef . FieldValueType . LAT_LON ) { o = getNativeValue ( fd , token , p ) ; } else { if ( fd . multiValued == false ) { fail ( fd . name , "expected single value, not array, since this field is not multiValued" ) ; } while ( true ) { if ( ! parseOneValue ( fd , p , doc ) ) { break ; } } return true ; } } else { if ( token == JsonToken . END_ARRAY ) { assert fd . multiValued ; return false ; } if ( fd . fieldType . indexOptions ( ) != IndexOptions . NONE && token == JsonToken . START_OBJECT ) { while ( true ) { token = p . nextToken ( ) ; if ( token == JsonToken . END_OBJECT ) { break ; } assert token == JsonToken . FIELD_NAME ; String key = p . getText ( ) ; if ( key . equals ( "boost" ) ) { token = p . nextToken ( ) ; if ( token == JsonToken . VALUE_NUMBER_INT || token == JsonToken . VALUE_NUMBER_FLOAT ) { boost = p . getFloatValue ( ) ; } else { fail ( fd . name , "boost in inner object field value must have float or int value; got: " + token ) ; } } else if ( key . equals ( "value" ) ) { o = getNativeValue ( fd , p . nextToken ( ) , p ) ; } else { fail ( fd . name , "unrecognized json key \"" + key + "\" in inner object field value; must be boost or value" ) ; } } if ( o == null ) { fail ( fd . name , "missing 'value' key" ) ; } } else { o = getNativeValue ( fd , token , p ) ; } } parseOneNativeValue ( fd , doc , o , boost ) ; return true ; }
parse one value for a field , which is either an object matching the type of the field , or a { boost : . . . , value : . . . } .
