title: Dynamic Solr core selection based on query parameter
body: <p>I use multiple Solr cores to index products from different segments. e.g. one index contains products from pharma(core1)and another contains products from groceries(core2) and 3rd from electronics goods(core3),.. actually I have cores also for categories and brands of products within those segments. </p>
  
  <p>The problem I have to solve is: When users searches for something, they shall not to be aware of these cores. Based on a query parameter the user sends; I want to figure out the right core/cores(s) to search. e.g., If the user query had <code>../select?q=apple&amp;seg=0x3e</code>, based on parameter: <code>seg=0x3e</code> the core2 &amp; core2 could be searched but not core3, for a different <code>seg=value</code>, a different set of cores shall be searched </p>
  
  <p>I could make this work with shards search and also configured shards in the solrconfig.xml. a good lead was provided <a href="https://stackoverflow.com/questions/2139030/search-multiple-solr-cores-and-return-one-result-set">here</a>. but this approach seems to be too static and I cannot influence limiting or selection of shards based on the query parameter. </p>
  
  <p>Is there a Solr way of doing this? like a custom SolrDispathcFilter?</p>
  
  <p>Thanks</p>