docs: function create_request_function(personality, doc_type,
  				 id_field, label_field, link_type){
  
      return function(request, query) {
  
  	// Declare a delayed response.
  	var response = new Deferred();
  	//response.wait(5000); // 5s wait for resolution
  
  	// New agent on every call.
  	var go = new bbop.golr.manager.ringo(server_loc, gconf);
  	go.set_personality(personality); // profile in gconf
  	go.add_query_filter('document_category', doc_type);
  	
  	// Define what we do when our GOlr (async) information
  	// comes back within the scope of the deferred response
  	// variable.
  	function golr_callback_action(resp){
  
  	    // Return caches for the values we'll collect.
  	    var ret_terms = [];
  	    var ret_descs = [];
  	    var ret_links = [];
  
  	    // Gather document info if available.
  	    //var found_docs = resp.documents();		
  	    bbop.core.each(resp.documents(),
  			   function(doc){
  			       var id = doc[id_field];
  			       var label = doc[label_field];
  
  			       ret_terms.push(label);
  			       ret_descs.push(id);
  			       ret_links.push(linker.url(id, link_type));
  			   });
  
  	    // Assemble final answer into the OpenSearch JSON
  	    // form.
  	    var ret_body = [query];
  	    ret_body.push(ret_terms);
  	    ret_body.push(ret_descs);
  	    ret_body.push(ret_links);
  	    var ans = {
  		status: 200,
  		headers: {'Content-Type': 'application/json'},
  		body: [bbop.core.to_string(ret_body)]
  	    };
  	    response.resolve(ans);
  	}
  
  	// Run the agent action.
  	//go.set_query(query);
  	go.set_comfy_query(query);
  	go.register('search', 'do', golr_callback_action);
  	go.update('search');
  
  	return response.promise;
      };
  }