One method for creating a multi-layer glossary is to have the same item listed as a contextual filter multiple times. For instance, a two-layer glossary works like so....

  • Layer 1: List of all letters in the alphabet (or at least, the ones in use). The user clicks a letter to go to Layer 2
  • Layer 2: List of all terms beginning with the letter chosen in Layer 1. The user clicks the term to proceed to a list of the content underlying that term.

To achieve this with taxonomy terms, "Content: Taxonomy term on node" must be added as a relationship in the view (currently it must be added twice as per #1205276: A single taxonomy relationship cannot be used for multiple contextual filters). Then "Taxonomy term: Name", using that relationship(s), must be added twice to the contextual filters. Both use "Display a summary" when no argument is passed, but the first one also uses "Glossary mode" and displays only 1 character.

Unfortunately, when a piece of content has multiple taxonomy terms assigned to it, and some of them begin with the same letter, that piece of content will be duplicated in the results for each taxonomy term beginning with the same letter that the chosen term begins with.

Environment

  • Drupal Core: 7.4
  • Theme: Garland 7.4

Repro Steps:

  1. Fill a Drupal site with a substantial amount of content tagged with taxonomy terms. Content must be tagged with multiple terms, and some terms must begin with the same letter.
  2. Begin editing a new or existing view
  3. Add the relationship "Content: Taxonomy term on node".
  4. Add a second relationship identical to the one created in step 3.
  5. Add a "Taxonomy term: Name" contextual filter that uses the relationship created in step 3.
  6. Configure the contextual filter to "Display a summary" when the argument is not provided and to use "Glossary mode" displaying only 1 character.
  7. Add a second "Taxonomy term: Name" contextual filter that uses the (duplicate) relationship created in step 4.
  8. Configure the second contextual filter to "Display a summary" when the argument is not provided.
  9. Using the preview, click one of the alphabet letters displayed in Layer 1.
  10. Using the preview, click one of the terms displayed in Layer 2. Click a term that has been applied to a piece of content that also has other terms beginning with the same letter chosen in step 7.

Expected Results:
The content matching the term is displayed and there are no duplicate pieces of content listed.

Actual Results:
Some content is duplicated for as many terms that it has that begin with the letter chosen in step 7. It would seem that the SQL query is constructed such that it displays content every time it contains argument 2 (the full term) but also every time it contains argument 1 (terms beginning with the letter chosen in step 7). The SQL query ought to be constructed such that it displays content only containing argument 2. Argument 1 exists only to display the list of terms in Layer 2.

Comments

dawehner’s picture

Thanks for providing such a detailed bug report, quite some other people should look at your example.

Sadly i can't help at the moment as

  • Glossaries are really complicated by definition
  • Taxonomy is also a really complicated module to integrate with views as it has a lot of features like hierachies etc.
  • A two-line glossary is also something really non-trivial thing

All this things together generates a really hard issue. Probably this will be attacked after the release but as nothing changed here really this is probably a bug since ever.

steenbob’s picture

The Views Bonus Pack module available in Drupal 5 had this scenario working properly. It's possible that there's a code snippet or two to steal from it that would enable this scenario.

In any case, though, I understand that it's not the highest priority. Thanks for your kind words about the bug report.

dawehner’s picture

Could you provide an export of the view, which is reusable?
This would be actually really great, as this lowers the barrier to work on this issue. You know this 5min's are mostly psychological, but they still exist.

damiankloip’s picture

Status: Active » Postponed (maintainer needs more info)

postponing. @steenbob, if you still have this issue and/or have an export to help, that would be awesome.

esmerel’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)