title: Searching by Entity Name and Last Modified Date
body: <p>I have a number of commands stored in RavenDb and they all implement ICommand.  I want to be able to search on the metadata of last modified and Raven-Entity-Name. I am currently doing a multi map on each command as below:</p>
  
  <pre><code>public class CommandAuditSearch_Index : AbstractMultiMapIndexCreationTask&lt;CommandAuditSearch_Index.Results&gt;
      {
          public class Results
          {
              public string CommandType { get; set; }
              public DateTime LastModified { get; set; }
          }
  
          public CommandAuditSearch_Index()
          {
              AddMap&lt;NewEmployeeStartCommand&gt;(employees =&gt; employees.Select(x =&gt; new
              {
                  CommandType = MetadataFor(x).Value&lt;string&gt;("Raven-Entity-Name"),
                  LastModified = MetadataFor(x).Value&lt;DateTime&gt;("Last-Modified")
              }));
  
              AddMap&lt;EmployeeLeaverCommand&gt;(employees =&gt; employees.Select(x =&gt; new
              {
                  CommandType = MetadataFor(x).Value&lt;string&gt;("Raven-Entity-Name"),
                  LastModified = MetadataFor(x).Value&lt;DateTime&gt;("Last-Modified")
              }));
  
              Index(results =&gt; results.CommandType, FieldIndexing.Analyzed);
          }
      }
  </code></pre>
  
  <p>I query this as follows:</p>
  
  <pre><code>session.Query&lt;CommandAuditSearch_Index.Results, CommandAuditSearch_Index&gt;()
                                .Where(x =&gt; x.CommandType == commandType &amp;&amp; x.LastModified &gt;= DateTime.Today).OfType&lt;ICommand&gt;().ToList();
  </code></pre>
  
  <p>I know there is an index already built into Raven to get the Tag (entity name) and last modified date but I cant seem to figure out how to get the results as my index above gives me.</p>
  
  <p>can anyone point me in the right direction of a static index where I don't have to have the multi maps as above for each command I have to query that gives me the results as a list of ICommands?</p>
  
  <p>Thanks </p>
  
  <p>Paddy</p>