title: Solr - Writing result of an Analyzer to different fields
body: <p>I have read a couple of tutorials and browsed the Solr documentation. But one thing isn't clear to me. Let me explain:</p>
  
  <p>Let's asume that the following document shall be indexed:</p>
  
  <pre><code>&lt;doc&gt;
    &lt;field name="id"&gt;R12345&lt;/field&gt;
    &lt;field name="title"&gt;My title&lt;/field&gt;
    &lt;field name="content"&gt;My Content&lt;/field&gt;
  &lt;/doc&gt;
  </code></pre>
  
  <p>Contrary to this document, the index should contain one extra field called "docType". This extra index field should be filled using a "completion rule". The idea behind this:</p>
  
  <p>If id starts with character "R" then write the String "Resolve" into field docType in the index. If id starts with character "C" then write the String "Contribute" into field docType in the index.</p>
  
  <p>The above document should be available in the index with the following fields:</p>
  
  <pre><code>id=R12345
  title=My Title
  content=My Content
  docType=Resolve
  </code></pre>
  
  <p>My idea is to use an Analyzer for this. The result of the Analyzer will then be written into field "id" in the index as usual (only a copy of the original text) but the result "Resolve" or "Contribute" should be written in another field.</p>
  
  <p>My basic question is: How can this be achieved in teh Analyzer (Java snipped)? To make it more complex the index field "docType" should be searchable and must be available in the search result. How will the schema look like for field id and docType?</p>
  
  <p>Thanks in advance
  Tobias</p>