faceted search - Solr: Facet one field with two outputs -


i'm using solr indexing products , organising them several categories. each document has taxon_names multi value field, categories stored human readable strings product.

now want fetch categories solr , display them clickable links user, without hitting database again. @ index time, permalinks every category mysql database, stored multi value field taxon_permalinks. generating links products, need human readable format of category , permalink (otherwise have such ugly urls in browser, when using plain human readable name of category, e.g. %20 space).

when facet search http://localhost:8982/solr/default/select?q=*%3a*&rows=0&wt=xml&facet=true&facet.field=taxon_names, list of human readable taxons counts. based on list, want create links, don't have hit database again.

so, possible retrieve matching permalinks solr different categories? example, xml this:

<response> <lst name="responseheader">   <int name="status">0</int>   <int name="qtime">0</int> </lst> <result name="response" numfound="6580" start="0"/>   <lst name="facet_counts">   <lst name="facet_queries"/>   <lst name="facet_fields">   <lst name="taxon_names">     <int name="books">2831</int>     <int name="music">984</int>       ...   </lst> </result> 

and inside taxon_names array need name of permalink.

maybe it's possible defining custom field type in config xmls. this, don't have enough experience solr.

since appears description faceting permalink in taxon_permalink field , values in field should correspond same category names in taxon_names field. solr allows facet on multiple fields, can facet on both fields , walk 2 facet results grabbing display name taxon_names facet values , permalink taxon_permalink facet values.

query:

 http://localhost:8982/solr/default/selectq=*%3a*&rows=0&wt=xml    &facet=true&facet.field=taxon_names&facet.field=taxon_permalink 

your output should similar following:

<response> <lst name="responseheader">   <int name="status">0</int>   <int name="qtime">0</int> </lst> <result name="response" numfound="6580" start="0"/>   <lst name="facet_counts">   <lst name="facet_queries"/>   <lst name="facet_fields">   <lst name="taxon_names">     <int name="books">2831</int>     <int name="music">984</int>       ...   </lst>   <lst name="taxon_permalink">     <int name="permalink1">2831</int>     <int name="permalink2">984</int>       ...   </lst> </result> 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -