Solr Hierarchical Faceting. Example needed

2019-08-15 05:14发布

问题:

I am new to solr. I want to implement hierarchical faceting in my application. I went through http://wiki.apache.org/solr/HierarchicalFaceting and also for the preparation of correct xml.

My need is to push XML to solr for indexing and it should show expected results as shown in solr wiki.

Problem: I am not understanding how should I specify facet fields in solrconfig/schema and also in the xml that will be posted. IF anyone out there can provide me example configuration that will be great. I would like to do it as it is performing on solr hierarchical wiki above.

I may be sounding like a total newbie here but I am stuck .

Ref Document-

<add>
  <doc> 
    <field name="id">4</field> 
    <field name="0/NonFic">General</field> 
    <field name="1/NonFic/Law">Rules</field> 
    <field name="1/NonFic/Sci">Chemistry</field> 
    <field name="1/NonFic/Sci">Physics</field> 
  </doc> 
</add>

Thanks 89neuron

回答1:

There is no difference in configuration for Solr Pivots and they don't need special configuration.

With the XML data configure as a simple field or multivalued field separate field.

Configure the fields as is in string format multivalued fields, if needed.
For e.g. field for Country and state would be 2 different fields.

Only during Search, you would need to pass facet.pivot=country,state to get the Hierarchy Facets.

<add>
  <doc> 
    <field name="id">4</field> 
    <field name="country">US</field> 
    <field name="country">India</field> 
    <field name="state">mumbai</field> 
    <field name="state">Nevada</field> 
  </doc> 
</add>


标签: solr