nested facets search

cancel
Showing results for 
Search instead for 
Did you mean: 
darionis
Active Member

nested facets search

Hi forum,

I wanted to check few stats of my repo, and I wanted to use facets to extract informartion about 'region' and 'type' of my documents. Both properties, 'type' and 'region' are part of document model.

Apparently, that would be possible with pivot facets. I tried various approcahes, form code and from solr web console but all i get is result for the first level (number of documents by region). I would also like to see count of each type in every region. Shortened response of my best try is this query:

http://localhost:8983/solr/alfresco/select?facet.pivot=ns:region,ns:type&facet=true&indent=on&q=TYPE:ns\:caseFile&rows=0&start=0&wt=json

which produces this result:

  ....

"_pivot_mappings_": {
"ns:region,ns:type": "text@s__lt@{http://xxx.eu/model/1.0}region,text@s__lt@{http://xxx.eu/model/1.0}type"
},

"facet.pivot": "ns:region,ns:type",
...

"facet_counts": { "facet_intervals": {}, "facet_pivot": { "ns:region,ns:type": [ { "field": "ns:region", "count": 479, "value": "{en}hk" }, { "field": "ns:region", "count": 120, "value": "{en}gk" }, { "field": "ns:region", "count": 5, "value": "{en}oc" }, { "field": "ns:region", "count": 2, "value": "{en}dep" }, ] }, "facet_queries": {}, "facet_fields": {}, "facet_heatmaps": {}, "facet_ranges": {} },

So, no data for the type.

In this example, facets are nested, as I expect them to be, but I am not able to get  such result. Am i doing something wrong?

Please give some hints. Thank you.

 

Dario

 

 

 

 

 

 

 

1 Reply
darionis
Active Member

Re: nested facets search

In order for it to work, fileds must be decalred as facetable in the content model.

<property name="ns:region">
  <description>...</description>
  <type>d:text</type>
  <mandatory enforced="true">true</mandatory>
  <index enabled="true">
    <facetable>true</facetable>
  </index>
</property>