title: select2 ajax: define formatResult, formatSelection and initSelection roles and behaviour
body: <p>I have implemented a basic select2 ajax element on my site: </p>
  
  <pre><code>$(function(){
      $('#appbundle_marketplace_product_ingredient_barcode').select2({
          minimumInputLength: 10,
          multiple: false,
          allowClear: true,
          quietMillis: 50,
          placeholder: 'Commencez à taper le code barre ici',
          ajax: {
              data: function (term) {
                  return {
                      q: term // search term
                  };
              },
              url: function(term) {
                  url="http://fr.openfoodfacts.org/api/v0/produit/" + term +".json";
                  return url;
              },
              dataType: 'json',
              results: function(data) {
                  if (data.status!=1) {return;}
                  if (data.product.complete!=1) {return;}
                  return {results: [{
                      text: data.code + " - " + data.product.product_name,
                      slug: data.code,
                      id: data.code
                  }]};
              },
          }
      });
  });
  </code></pre>
  
  <p>I am looking forward to better the display with the help of templating methods formatResult, formatSelection and InitSelection.
  I have read the documentation (which don't totally understand) and examples on the net.</p>
  
  <p>Although i can understand what each method is supposed to do, I am unable to make them work properly.</p>
  
  <ul>
  <li>Is there a required format of the json response (in my example I get one single object and I could only make it work by transforming it into an object made on an array of objects ?$!!?
  example url: <a href="http://fr.openfoodfacts.org/api/v0/produit/3029330003533.json" rel="nofollow">http://fr.openfoodfacts.org/api/v0/produit/3029330003533.json</a></li>
  </ul>
  
  <p>As for formatResult, formatSelection and InitSelection:</p>
  
  <ul>
  <li>What is/should be the format (array/object/which keys?) of their attributes?</li>
  <li>What is/should be the format of the response?</li>
  <li>How are they called by select 2 and how is their response treated?</li>
  </ul>
  
  <p>Any help as to understand this behaviour would be much appreciated!</p>