When building a filter based on taxonomy terms, the vocabulary ids are compared against the location.vid rather than the location_instance.vid field. There is no location.vid field. The result is that no results are returned from the query no matter what vocabulary is specified.

Comments

TheCompWiz’s picture

When simply adding a filter using the "Taxonomy: Term ID (with depth)"
The resulting query looks like the following:

SELECT location.lid AS lid,
   location.name AS location_name
 FROM location location 
 WHERE location.vid IN (
  SELECT tn.vid FROM term_node tn
  WHERE tn.tid  IN (20, 26, 24, 22, 28, 25, 23, 27, 29, 21)
  )

If you add any field from nodes, the query changes slightly to the following:

SELECT location.lid AS lid,
   location.name AS location_name,
   node.nid AS node_nid
 FROM location location 
 LEFT JOIN location_instance location_instance ON location.lid = location_instance.lid
 LEFT JOIN node node ON location_instance.vid = node.vid
 WHERE location.vid IN (
  SELECT tn.vid FROM term_node tn
  WHERE tn.tid  IN (20, 26, 24, 22, 28, 25, 23, 27, 29, 21)
  )

This is still an invalid query, as the "location.vid" field is still used which (as said previously) doesn't exist.

In short, we do end up with both a "node" and a "location_instance" that both present a "vid" field (vocabulary id) that we can create a valid vocabulary comparison.

A valid query should look like this:

SELECT location.lid AS lid,
   location.name AS location_name,
   node.nid AS node_nid
 FROM location location 
 LEFT JOIN location_instance location_instance ON location.lid = location_instance.lid
 LEFT JOIN node node ON location_instance.vid = node.vid
 WHERE location_instance.vid IN (
  SELECT tn.vid FROM term_node tn
  WHERE tn.tid  IN (20, 26, 24, 22, 28, 25, 23, 27, 29, 21)
  )
havran’s picture

I have same problem.

havran’s picture

Status: Active » Fixed

Here is solution: http://drupal.org/node/571066 - don't use location view type but node view type.

TheCompWiz’s picture

Status: Fixed » Needs work

That's not really a fix... as other modules that depend on location (like gmap) end up displaying 1 map per node rather than 1 map with all locations displayed within.

legolasbo’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

Closing old D6 issues as D6 is end of life