Note: I originally posted this question in the forums on July 22, 2013 but it seems there isn't an easy way to move a forum post to this issue queue, so I was advised to cross post it. Thank you for understanding.

Hello. I'm trying to create a table using Views to organize about 200 someodd people that we can sort with a variety of features. I'd like to use depth for better categorization of things we can tag the people with using a Vocabulary specifically structured for this purpose. For example, I might have some part of the taxonomy as such:

  • Faculty
    • Part-time instructors
    • Full-time instructors
  • Students
    • Graduate
    • Undergraduate
  • College
    • Liberal Arts
      • History
      • English
    • Engineering
    • Natural Science

On the page I'm building, we currently have two autocomplete "has taxonomy term" boxes--the first is with depth (so default is "is one of") and the second is not with depth (so the user can choose "is one of" "is all of" etc.). This allows, using the sample taxonomy above, a search such as:

"Faculty who are in History AND English" or "Faculty who are in History OR English" -- both work because the nodes being fed into the view will be tagged with something underneath "Faculty" (so the first box with depth picks them up) and would be tagged with a department such as History or English (thus picked up in the second box when that exact term is entered into the box).

However, we CANNOT yet search for "Faculty who are in Liberal Arts" or anything like that because the second box does not have depth, and we will be tagging by department, not college. Because of the amount of interdisciplinary work done at our department and the ways we will be organizing our people, we would greatly appreciate some sort of functionality to be able to do these searches without tagging each and every person with every level of depth in the taxonomy (otherwise why even have depth?).

I've searched for a tutorial but perhaps I don't know the way to phrase what I'm trying to do because nothing has turned up (literally 16 results in Google, including this post saying that Views is designed to not work this way for some PHP reason I don't quite understand). So, any help toward the right direction (using a certain module in addition to Views or instead of Views, using certain Views settings, etc.) would be much appreciated to be able to get the functionality we're looking for. It doesn't even have to be with two search boxes--I'm happy to find a way to cram a ton of drop down menus in there if that's literally the only way to do it. We just need to be able to filter in ways that doesn't turn up only "OR" results, but also "AND" results with multiple taxonomy terms.

Does this all make sense? I am happy to continue to clarify if someone has any insight at all toward the right direction.

I'm (now) hoping to have this figured out by February 2014 and I know that's kind of tight but if anyone knows a resource or has some tips to help me meet either of those goal it would be much appreciated and it would honestly really, really help our entire department as we continue to expand our reach and involvement.

Thank you in advance.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Thambos’s picture

Title: Is there a filtering/search function like "is all of" for "has taxonomy terms (with depth)"? » Is there any way to set a filtering/search function like "is all of" for "has taxonomy terms (with depth)"?
Component: Miscellaneous » taxonomy data
Thambos’s picture

I've found some additional modules (Refine by Taxonomy, Taxonomy Filter) that look like they could do this, but there are not versions for Drupal 7. Does anyone know of something that is for Drupal 7 that could do this if Views absolutely can't?

I'm not a programmer and I'm very new to PHP--learning what I need to as I work in Drupal--so even if this is a "Sorry kid, it just doesn't work that way;" I would appreciate knowing that so I can let our dept. know and start looking into alternatives in our own organizing or outside of Drupal that have this functionality.

Thanks again in advance, I really, really appreciate whatever anyone can offer.

EDIT: Taxonomy Edge, Taxonomy Facets, and Search API came up in suggestions on IRC #drupal-support today. Are these moving toward the right direction? Do they work well with Views?

Thambos’s picture

Title: Is there any way to set a filtering/search function like "is all of" for "has taxonomy terms (with depth)"? » Is there a way to make a filtering/search function like "is all of" for "has taxonomy terms (with depth)"?
Category: support » feature
Thambos’s picture

Issue summary: View changes

Added which day I posted in the forums so that people know when I asked this question.

Thambos’s picture

Issue summary: View changes

Hello! I'm working on this project again and we are still hoping for a solution to this that will work. Updated the post to reflect a new, flexible deadline. Any ideas in any direction to help with this? Thank you in advance.

cslevy’s picture

Seems that these filters are implemented to support only OR between the values. " Due to the number of JOINs it would require, AND will be treated as OR with this filter."

I created a patch which will add all the required JOINS for "Content: Has taxonomy term ID with depth (using joins)"

I'm not sure if this breaks anything, testing needed.

cslevy’s picture

Status: Active » Needs review
Chris Matthews’s picture

Version: 7.x-3.7 » 7.x-3.x-dev
Status: Needs review » Needs work
Issue tags: +Needs reroll

The 2 year old patch in #5 to views_handler_argument_term_node_tid_depth_join.inc does not apply to the latest views 7.x-3.x-dev and if still relevant needs to be rerolled.

Checking patch modules/taxonomy/views_handler_argument_term_node_tid_depth_join.inc...
error: while searching for:
    }

    // Join on taxonomy index table.
    $join = new views_join();
    $join->table = 'taxonomy_index';
    $join->field = 'nid';
    $join->left_table = $this->table_alias;
    $join->left_field = $this->real_field;
    $join->type = 'INNER';
    $join->extra = array(
      array(
        'field' => 'tid',
        'value' => $tids,
        'operator' => $operator,
      )
    );
    $taxonomy_index_alias = $this->query->add_relationship('taxonomy_index', $join, 'node');

    // Distinct is required to prevent duplicate rows.
    $this->query->distinct = TRUE;

error: patch failed: modules/taxonomy/views_handler_argument_term_node_tid_depth_join.inc:161
error: modules/taxonomy/views_handler_argument_term_node_tid_depth_join.inc: patch does not apply
Andrew Answer’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
1.64 KB

Patch rerolled.