I have a content type that uses the Location Module and CCK Location fields.

I created an advanced search view to search this content. I am using exposed "City" and "Country" location fields in addition to about 10 other CCK fields to search on.

All the search fields work except the Location fields. If I select County except "ANY", or type in any thing in the "city" field I get no results.

Here's the sql statement WITHOUT a "city" field in the search that returns a valid list of content

SELECT node.nid AS nid,
node.title AS node_title,
node_revisions.teaser AS node_revisions_teaser,
node_revisions.format AS node_revisions_format,
node.type AS node_type,
location.country AS location_country
FROM node node
LEFT JOIN content_type_school_listing node_data_field_degrees ON node.vid = node_data_field_degrees.vid
LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid
LEFT JOIN location_instance location_instance ON node.vid = location_instance.vid
LEFT JOIN location location ON location_instance.lid = location.lid
WHERE (node.type in ('book', 'school_listing')) AND (node.status <> 0) AND (UPPER(node_data_field_degrees.field_degrees_value) LIKE UPPER('%ba%')) AND (UPPER(node_data_field_degrees.field_majors_value) LIKE UPPER('%silly%'))

Here's the sql with the location city field included.

SELECT node.nid AS nid,
node.title AS node_title,
node_revisions.teaser AS node_revisions_teaser,
node_revisions.format AS node_revisions_format,
node.type AS node_type,
location.country AS location_country
FROM node node
LEFT JOIN location_instance location_instance ON node.vid = location_instance.vid
LEFT JOIN location location ON location_instance.lid = location.lid
LEFT JOIN content_type_school_listing node_data_field_degrees ON node.vid = node_data_field_degrees.vid
LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid
WHERE (node.type in ('book', 'school_listing')) AND (node.status <> 0) AND ((UPPER(location.city) LIKE UPPER('%South%'))) AND (UPPER(node_data_field_degrees.field_degrees_value) LIKE UPPER('%ba%')) AND (UPPER(node_data_field_degrees.field_majors_value) LIKE UPPER('%silly%'))

The city being searched for is in the location table in two different records
Doing a select on the location table with ((UPPER(location.city) LIKE UPPER('%South%'))) returns two records

Doing a select on location and the content tables with ((UPPER(location.city) LIKE UPPER('%South%'))) AND (UPPER(node_data_field_degrees.field_degrees_value) LIKE UPPER('%ba%')) AND (UPPER(node_data_field_degrees.field_majors_value) LIKE UPPER('%silly%')) returns zero records.

So it appears the sql statement is not a correct join or the data stored in the table is not correctly stored..

I will enter this into the Location module bug database.

Comments

sderrick’s picture

Is this the same bug as

CCK/Views proper support using relationships
http://drupal.org/node/391160

or

location_cck needs a views relation
http://drupal.org/node/347030

If so or if not, is there a way(hack) I can make my cck location fields work nice with a views search dialog?

Scot

sderrick’s picture

Is there no answer to this bug? I'd love to be able to use the Location module to hook into google maps, but if its useless for standard search terms its DOA for me.

sderrick’s picture

Priority: Normal » Critical
sderrick’s picture

Issue 347030 http://drupal.org/node/347030 has a work around on comment #33 by YesCT

Quote**

I made a video trying to see what this patch is for.
http://cathytheys.blip.tv/file/2157286
More coming, more questions and more demos.
But I got some stuff to work without the patch.

Unquote**

Scott

WorldFallz’s picture

Status: Active » Closed (duplicate)