title: How to use jquery-select2 context object to refine search results?
body: <p>(Firstly, apologies from this first time submitter for what is essentially a question arising due to my being too noob to be able to translate the documentation into a working solution. Hopefully someone will take pity on me :) )</p>
  
  <p>Basically I have the following simple ajax based select2 input field working : </p>
  
  <pre><code>$(document).ready(function () {
  
      var allUsersUrl = '/cmd/match_list/usrname';
  
      $('#username').select2({
          placeholder: 'Enter username',
          minimumInputLength: 3,
          allowClear: true,
          dropdownAutoWidth: true,
          ajax: {
              quietMillis: 150,
              url: allUsersUrl,
              dataType: 'json',
              data: function (term, page, context) {
                  return {
                      fullstr: "n",
                      fromldap: "y",
                      exact: "n",
                      string: term,
                  };
              },
              results: function (data, page) {
                  return { results: data.Results };
              }
          }
      });
  }
  .
  .
  .
  &lt;input id="username" name="username"&gt;
  </code></pre>
  
  <p>...but since this involves a relatively slow and expensive back end LDAP query, I would like  any subsequent key presses received after the lookup to search the initial results, instead of firing off another brand new (but very similar) back end lookup.</p>
  
  <p>For example, when I type 'smi' in the field, a shortlist of 52 matches is shown. When I then press 't' I want to look for 'smit' in the shortlist, and not do another back end lookup as currently happens.</p>
  
  <p>The documentation talks about a '<a href="http://ivaynberg.github.io/select2/#doc-query-options-callback" rel="nofollow" title="context">context</a>' object that sounds very relevant to my problem, but I just cant seem to make the leap from that to a working solution, and so far I have failed to find any examples of other people using this object.</p>
  
  <p>Any suggestions will be gratefully received, and apologies again if this is just basic stuff that doesnt belong in this forum. Thanks in advance.</p>