title: RavenDB - Adding Index breaks unrelated queries
body: <p>When I add the index below to my raven database a simple query like </p>
  
  <pre><code>return Session.Query&lt;R&gt;().FirstOrDefault(x =&gt; x.RId == Id); 
  </code></pre>
  
  <p>Always returns null. Only after forcing Raven to remove my custom index does desired functionality return. Why is this?</p>
  
  <p>The Index with side effects:</p>
  
  <pre><code>public class RByLatestCommentIndex : AbstractIndexCreationTask&lt;R&gt;
  {
      public RByLatestCommentIndex()
      {
          SetMap();
      }
  
      void SetMap()
      {
          Map = r =&gt; r.Select(x =&gt; new
          {
              Id = x.Id,
              TimeStamp = x.Comments.Count() &gt; 0 ? x.Comments.Max(u =&gt; u.Created)
                  : x.Created
          }).OrderByDescending(y =&gt; y.TimeStamp).Select(r =&gt; new { Id = r.Id });
      }
  }
  
  public class RIdTransformer : AbstractTransformerCreationTask&lt;R&gt;
  {
      public RIdTransformer()
      {
          TransformResults = ids =&gt; ids.Select(x =&gt; LoadDocument&lt;R&gt;(x.Id));
      }
  }
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>In response to <a href="https://stackoverflow.com/users/6366/ayende-rahien">Ayende Rahien's</a> comment:</p>
  
  <p>There's a query in the DB which would otherwise be used (Auto/R/ByRID) but the index used looks like this, puzzling enough: </p>
  
  <pre><code>from doc in docs.Rs select new { Images_Count__ = doc.Images["Count()"], RId = doc.RId } 
  </code></pre>
  
  <p>What explains this behaviour? And, will I have to add a static index to be able to query R by RId ?</p>