else {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "invalid key: "+v + " ["+ parser.getPosition()+"]" );
}
}
else if( obj instanceof SolrInputDocument ) {
SolrInputDocument doc = (SolrInputDocument)obj;
SolrInputField f = doc.get( v );
if( f == null ) {
f = new SolrInputField( v );
doc.put( f.getName(), f );
}
stack.push( f );
}
else {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "hymmm ["+ parser.getPosition()+"]" );
}
}
else {
addValToField(stack, parser.getString(), inArray, parser);
}
break;
case JSONParser.LONG:
case JSONParser.NUMBER:
case JSONParser.BIGNUMBER:
addValToField(stack, parser.getNumberChars().toString(), inArray, parser);
break;
case JSONParser.BOOLEAN:
addValToField(stack, parser.getBoolean(),inArray, parser);
break;
case JSONParser.NULL:
parser.getNull();
/*** if we wanted to remove the field from the document now...
if (!inArray) {
Object o = stack.peek();
// if null was only value in the field, then remove the field
if (o instanceof SolrInputField) {
SolrInputField sif = (SolrInputField)o;
if (sif.getValueCount() == 0) {
sdoc.remove(sif.getName());
}
}
}
***/
addValToField(stack, null, inArray, parser);
break;
case JSONParser.OBJECT_START:
if( stack.isEmpty() ) {
stack.push( new SolrInputDocument() );
}
else {
obj = stack.peek();
if( obj instanceof SolrInputField ) {
// should alreay be pushed...