def AddFieldsToDocumentPb(doc_id, fields, document):
  if doc_id is not None:
    document.set_id(doc_id)
  for field_tuple in fields:
    name = field_tuple[0]
    value = field_tuple[1]
    field = document.add_field()
    field.set_name(name)
    field_value = field.mutable_value()
    field_value.set_string_value(value)
    if len(field_tuple) > 2:
      field_value.set_type(field_tuple[2])
Returns postion (0 indexed) of first occurence of argument within
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/api/search/search_util.py/AddFieldsToDocumentPb--crossover with--dataset/ETHPy150Open cloudera/ibis/ibis/expr/api.py/_find_in_set