Solr Hierarchical Faceting. Example needed

China☆狼群 提交于 2019-12-24 18:06:09

问题


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>


来源:https://stackoverflow.com/questions/18533561/solr-hierarchical-faceting-example-needed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!