My facets are automatically sorted by the facet integer value and then alphabetically, but I need the order in facet B to be dependent on the order in facet A.
Current result:
<lst name="facet_fields">
<lst name="label_nl_0">
<int name="Accessoires">6</int>
<int name="Audio / Music">6</int>
</lst>
<lst name="slug_nl_0">
<int name="aa-to-z-music">6</int>
<int name="random-slug">6</int>
</lst>
</lst>
Desired result:
<lst name="facet_fields">
<lst name="label_nl_0">
<int name="Accessoires">6</int>
<int name="Audio / Music">6</int>
</lst>
<lst name="slug_nl_0">
<int name="random-slug">6</int>
<int name="aa-to-z-music">6</int>
</lst>
</lst>
Whatever the order is in facet label_nl_0
, the facet slug_nl_0
should have the order that matches with the label_en/slug_en value as defined in the database (see below).
Here's how I get the data in Solr:
data-config.xml
SELECT label_en as label_en_0,slug_en as slug_en_0 FROM products WHERE id=@productid
schema.xml
<field name="slug_en_0" type="string" indexed="true" stored="true"/>
<field name="label_en_0" type="string" indexed="true" stored="true"/>
In the database I have products that are assigned two the following 2 categories (6 in the first category and another 6 in the second category). Products always are in exactly 1 category:
Category 1
label_en = Accessories
slug_en = random-slug
Category 2
label_en = Audio / Music
slug_en = aa-to-z-music