title: How to perform indexing/search on multiple tables in SolrNet
body: <p>I am using SolrNet to index/search data on set of tables.</p>
  
  <p>I have two tables Category and Item.</p>
  
  <p>Both the tables have same fields, Hence i have a base mapping class form which i derive.</p>
  
  <pre><code>[Serializable]
      [XmlRoot(ElementName = "SolrSearchEntity", Namespace = "")]
      [DataContract(Name = "SolrSearchEntity", Namespace = "")]
      public class SolrSearchEntity
      {
          [XmlElement(ElementName = "Id")]
          [DataMember(Name = "Id", IsRequired = true)]
          [SolrUniqueKey("id")]
          public string Id { get; set; }
  
          [XmlElement(ElementName = "Name")]
          [DataMember(Name = "Name", IsRequired = true)]
          [SolrField("name")]
          public string Name { get; set; }
      }
  
  public class Category : SolrSearchEntity
      {        
      }
  
      public class Item : SolrSearchEntity
      {
      }
  </code></pre>
  
  <p>code block for indexing Category data</p>
  
  <pre><code>using (SolrBaseRepository.Instance&lt;Category&gt; repository = new SolrBaseRepository.Instance&lt;Category&gt;())
              {
                  var output = ItemStoreDataManager.GetAllCategoryNames(dataAdapter);
                  repository.Start();
                  var solr = ServiceLocator.Current.GetInstance&lt;ISolrOperations&lt;Category&gt;&gt;();
                  solr.AddRange(output);
                  solr.Commit();
              }
  </code></pre>
  
  <p>code block for indexing Item data</p>
  
  <pre><code>using (SolrBaseRepository.Instance&lt;Item&gt; repository = new SolrBaseRepository.Instance&lt;Item&gt;())
                  {
                      var output = ItemStoreDataManager.GetAllItemNames(dataAdapter);
                      repository.Start();
                      var solr = ServiceLocator.Current.GetInstance&lt;ISolrOperations&lt;Item&gt;&gt;();
                      solr.AddRange(output);
                      solr.Commit();
                  }
  </code></pre>
  
  <p>My Schema.xml has</p>
  
  <pre><code> &lt;fields&gt;
      &lt;!-- declare fields of entity class --&gt;
      &lt;field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" /&gt;
      &lt;field name="name" type="text_general" indexed="true" stored="true" omitNorms="true"/&gt;
  
      &lt;field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/&gt;
      &lt;field name="_version_" type="long" indexed="true" stored="true"/&gt;
  
    &lt;/fields&gt;
  </code></pre>
  
  <p>Querying for data in Category</p>
  
  <pre><code>  var entities = ItemStoreManager&lt;Category&gt;.Search(keyword); which will internally execute this.
  
    new SolrBaseRepository.Instance&lt;T&gt;().Start();
    var solr = ServiceLocator.Current.GetInstance&lt;ISolrOperations&lt;T&gt;&gt;();
    var results = solr.Query(keyword);
  </code></pre>
  
  <p>Strangely, I am getting the records from the <strong>Item</strong> table.</p>
  
  <p>How would i tell the SolrNet (search engine) to look within the type i have specified.</p>
  
  <p>Or i am indexing correctly in the first place? </p>
  
  <p>Please help.</p>
  
  <p>Thanks,</p>