0

I have a content type that has a term reference field to a vocabulary called 'Categories'.

Categories

- Cat 1
- - Cat 1.1*
- - Cat 1.2
- - - Cat 1.2.1
- - - Cat 1.2.2*
- - Cat 1.3
- Cat 2
- Cat 3
- - Cat 3.1
- - - Cat 3.1.1
- - Cat 3.2

As you can see, the Category vocabulary has a terms in a Hierarchy.

Using Search API and Solr, im indexing the term reference field using 'Parents All'. I have set the index up to index the hierarchy.

Its all working perfectly, however, not all terms are listed in the facet box, despite the products being indexed correctly. There are a few terms that do not appear. (marked with a * above).

However, I know that the nodes are indexing correctly. I know this as I can filter by a facet that is working, then swap the argument in the URL arguments for the TID of a term that isnt working. When this happens, the products are displayed correctly in the view.

So my question is...what could cause Drupal/Search API to not display all items in a facet.

How can I start to debug this?

I have tried rewriting the facet using this function:

function HOOK_facet_items_alter(&$build, &$settings) {
                        if ($settings->facet == "YOUR_FACET_NAME") {
                          foreach($build as $key => $item) {
                            $build[$key]["#markup"] = drupal_strtoupper($item["#markup"]);
                          }
                        }
                      }

However, when I print out the list of terms inside $build the ones that arn't displaying are not listed in the array.

ANy help or any other hook suggestions are greatly appreciated.

0

Turns out that I had a limit on the number of items to display.

To fix it, I had to change the limit under Facet > Display.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.