title: Counting in Solr
body: <p>I am storing the following document in Solr:</p>
  
  <pre><code>  doc {
      id: string; // this is a unique string that looks like an md5 result
      job_id: string; // this also looks like an md5 result -- this is not unique
      doc_id: number; // this is a long number -- this is not unique
      text: string; // this is stored, indexed text -- this is not unique
    }
  </code></pre>
  
  <p>Now what I want to do is count the number of docs (doc_id) that have the text foo in them. So if this was SQL I would want to issue something like this:</p>
  
  <pre><code>SELECT count(distinct doc_id)
  FROM Doc
  WHERE text like '%foo%';
  </code></pre>
  
  <p>Thanks in advance.</p>