title: How to create Solr schema for hierarchical facet by splitting data into multiple fields at index time
body: <p>I want to implement Solr hierarchical facet for my application where there is 2 level hierarchy between Category and SubCategory. I want to use a solution mentioned on <a href="http://wiki.apache.org/solr/HierarchicalFaceting#Pivot_Facets" rel="nofollow">http://wiki.apache.org/solr/HierarchicalFaceting#Pivot_Facets</a> link. </p>
  
  <p><strong>The flattened data will be as below:</strong></p>
  
  <pre><code>Doc#1: NonFic &gt; Law
  Doc#2: NonFic &gt; Sci
  Doc#3: NonFic &gt; Sci &gt; Phys
  </code></pre>
  
  <p>And this data should be split into a separate field for each level of the hierarchy at index time. Same as below.</p>
  
  <p><strong>Indexed Terms</strong></p>
  
  <pre><code>Doc#1: category_level0: NonFic; category_level1: Law
  Doc#2: category_level0: NonFic; category_level1: Sci
  Doc#3: category_level0: NonFic; category_level1: Sci, category_level2:Phys
  </code></pre>
  
  <p>So can anyone please suggest ways to implement this? How do I define Solr schema to achieve this? I could not find any reference for splitting data as mentioned above at Index time.</p>
  
  <p>Thanks,</p>
  
  <p>Priyanka</p>