http://wiki.apache.org/solr/HierarchicalFaceting

On Wed, May 15, 2013, at 09:44 AM, varsha.yadav wrote:
> Hi Everyone,
> 
> I am working on Hierarchical Faceting. I am indexing location of 
> document with their state and district.
>   I would like to find counts of every country with state count and 
> district count. I found facet pivot working well to give me count if i 
> use single valued fields like
> -------
> <doc>
> <str name="country">india</str>
> <str name="state">maharashtra</str>
> </doc>
> <doc>
> <str name="country">india</str>
> <str name="state">gujrat</str>
> </doc>
> <doc>
> <str name="country">india</str>
> <str name="district">Faridabad</str>
> <str name="state">Haryana</str>
> </doc>
> <doc>
> <str name="country">china</str>
> <str name="district">foshan</str>
> <str name="state">guangdong</str>
> </doc>
> ------------
> I found results that is fine :
> <arr name="country,state,district,event">
> <lst>
> <str name="field">country</str>
> <str name="value">india</str>
> <int name="count">1</int>
> <arr name="pivot">
> 
> <lst>
> <str name="field">state</str>
> <str name="value">maharashtra</str>
> <int name="count">1</int>
> <arr name="pivot"></arr>
> <lst>
> <str name="field">state</str>
> <str name="value">Haryana</str>
> <int name="count">1</int>
> <arr name="pivot">
> <lst>
> <str name="field">district</str>
> <str name="value">Faridabad</str>
> <int name="count">1</int>
> </lst>
> </arr>
> </lst>
> </arr>
> </lst>
> </arr>
> </lst>
> <lst>
> <str name="field">country</str>
> <str name="value">china</str>
> <int name="count">1</int>
> <arr name="pivot">
> <lst>
> <str name="field">state</str>
> ....
> </lst>
> </arr>
> 
> 
> But if my document have multiple location like :
> 
> <doc>
> <arr name="location">
> <str>japan|JAPAN|null|</str>
> <str>
> brisbane|Australia|Queensland
> </str>
> <str>
> afghanistan|AFGHANISTAN|null
> </str>
> </arr>
> </doc>
> 
> <doc>
> <arr name="location">
> <str>
> afghanistan|AFGHANISTAN|null
> </str>
> </arr>
> </doc>
> 
> <doc>
> <arr name="location">
> <str>
> brisbane|Australia|Queensland
> </str>
> </str>
> </arr>
> </doc>
> 
> 
> Can anyone tell , me how should i put data in solr index to get 
> hierarical data.
> 
> Thanks
> Varsha

Reply via email to