1

I'm working on customizing some templates on an existing Drupal 8 site. I was about to start working on the taxonomy term page but noticed only a single content is showing in it. I already checked and there are several contents associated with the taxonomy I'm testing.

It's not the pager settings, which could be limiting the results to 1. Neither the filter apparently, I've disabled all filter and sort criteria.

Another thing I tried was clearing the cache. I even disabled the cache for this view, completely.

Finally, it seems the theme has no custom hook that could be changing this view in some way.

Here are the settings I currently have for this view:

View settings

What else could I check in order to show the correct results?

3
  • 3
    In the Views settings (/admin/structure/views/settings) enable the Show the SQL query setting to see the query being used to pull content from the DB. You can use that query to query the DB directly to troubleshoot if the problem is at query level or views itself. – Shawn Conn Aug 21 '20 at 16:38
  • Thanks @ShawnConn. That helped me figure out what is happening. The query uses taxonomy_index table. However, the categories were recently set using a field table, right on the database. I guess I just have to fill the taxonomy_index table accordingly now. – Gustavo Straube Aug 21 '20 at 17:00
  • This way, maybe? drupal.stackexchange.com/a/177335/98980 – Gustavo Straube Aug 21 '20 at 17:00
2

After following @ShawnConn's advice on enabling the Show the SQL query option, I figured out what happened.

The query was indeed returning only one result. But then I remembered the categories were recently changed right on the database. To do that, we've updated the respective field table -- node__field_categories in our case. However, the taxonomy_index table was not updated. I went ahead and manually (again, I know) updated the taxonomy_index table and now the view is showing the expected content. I hope this is the last and only side effect.

The lesson learned is: only touch the database if you really know what you're doing. And even then, think twice. :P

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.