Active
Project:
Location
Version:
7.x-3.x-dev
Component:
Location_views
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 Jul 2011 at 15:37 UTC
Updated:
27 Jan 2014 at 16:12 UTC
Jump to comment: Most recent
Hi everyone,
General problem:
I've created a view with exposed filters that searches users based on their role and their proximity/distance. The problem I am running into is that filtering by certain roles seems to produce accurate location results, while certain roles return no results at all.
Thank you for your help.
More detail:
Could this be a problem with the amount of users it's trying to query? Does anybody have any other possible problems?
Extra information:
If you want to give the live version a try, go to: http://grodan101.com/store
I'm also using Profile 2, but that does not affect the filter criteria.
Queries:
Working properly:
SELECT users.picture AS users_picture, users.uid AS uid, users.name AS users_name, users.mail AS users_mail, location.lid AS location_lid, profile_users.pid AS profile_users_pid, location.name AS location_name, 'profile2' AS field_data_field_store_hours_profile2_entity_type, 'profile2' AS field_data_field_website_profile2_entity_type, (IFNULL(ACOS(0.828169832503*COS(RADIANS(location.latitude))*(-0.475718165272*COS(RADIANS(location.longitude)) + -0.879597764453*SIN(RADIANS(location.longitude))) + 0.56047723284*SIN(RADIANS(location.latitude))), 0.00000)*6371396.0928) AS location_distance_sort
FROM
{users} users
INNER JOIN {profile} profile_users ON users.uid = profile_users.uid
LEFT JOIN {location_instance} location_instance ON users.uid = location_instance.uid
LEFT JOIN {location} location ON location_instance.lid = location.lid
INNER JOIN {users_roles} users_roles ON users.uid = users_roles.uid
WHERE (( (users.status <> '0') AND (users_roles.rid = '8') )AND( (location.latitude > '26.8526552378' AND location.latitude < '41.3249607622' AND location.longitude > '-127.154385345' AND location.longitude < '-109.657854655') AND ((IFNULL(ACOS(0.828169832503*COS(RADIANS(location.latitude))*(-0.475718165272*COS(RADIANS(location.longitude)) + -0.879597764453*SIN(RADIANS(location.longitude))) + 0.56047723284*SIN(RADIANS(location.latitude))), 0.00000)*6371396.0928) < '804673.5') ))
ORDER BY location_distance_sort ASC, location_name ASC
LIMIT 30 OFFSET 0Returns nothing:
SELECT users.picture AS users_picture, users.uid AS uid, users.name AS users_name, users.mail AS users_mail, location.lid AS location_lid, profile_users.pid AS profile_users_pid, location.name AS location_name, 'profile2' AS field_data_field_store_hours_profile2_entity_type, 'profile2' AS field_data_field_website_profile2_entity_type, (IFNULL(ACOS(0.828169832503*COS(RADIANS(location.latitude))*(-0.475718165272*COS(RADIANS(location.longitude)) + -0.879597764453*SIN(RADIANS(location.longitude))) + 0.56047723284*SIN(RADIANS(location.latitude))), 0.00000)*6371396.0928) AS location_distance_sort
FROM
{users} users
INNER JOIN {profile} profile_users ON users.uid = profile_users.uid
LEFT JOIN {location_instance} location_instance ON users.uid = location_instance.uid
LEFT JOIN {location} location ON location_instance.lid = location.lid
INNER JOIN {users_roles} users_roles ON users.uid = users_roles.uid
WHERE (( (users.status <> '0') AND (users_roles.rid = '6') )AND( (location.latitude > '26.8526552378' AND location.latitude < '41.3249607622' AND location.longitude > '-127.154385345' AND location.longitude < '-109.657854655') AND ((IFNULL(ACOS(0.828169832503*COS(RADIANS(location.latitude))*(-0.475718165272*COS(RADIANS(location.longitude)) + -0.879597764453*SIN(RADIANS(location.longitude))) + 0.56047723284*SIN(RADIANS(location.latitude))), 0.00000)*6371396.0928) < '804673.5') ))
ORDER BY location_distance_sort ASC, location_name ASC
LIMIT 30 OFFSET 0
Comments
Comment #1
mandclu commentedIt sounds like a permissions issue. Does role 6 have permission to see longitude and latitude?
Comment #2
paulsham commentedI figured out the problem and it was my lack of understanding with the module.
We were importing the users directly into the database due to the amount and I thought we had included all the location information into the right tables, but missed the fact that the Location module calculates the latitude and longitude when you enter postal code in. Because we were going directly into the database, this calculation was not happening.
Comment #3
ankur commentedComment #4
raulmuroc commentedTo work views + location (filter distance/proximity) + profile2, we should adapt the following D6 code to D7:
This code is introduced under distance/proximity filter through PHP code for latitude,longitude.
Help is welcome! :-)
Comment #5
mikefyfer commentedDid you make any progress on implementing this with profile2 in D7?
Thanks
Comment #6
raulmuroc commentedNot really and I won't have time. I am full cuz of job.
Sorry about that.
Comment #7
raulmuroc commentedNo bug to be fixed, more like a support request indeed. Just needed to port the code stated above to D7. That's just a workaround somebody must find out cleverly :-)
Comment #8
raulmuroc commentedNow is correct. Hope this aims people to work harder on this issue.
Comment #9
damienmckennaShouldn't "inconsistent results" be a bug? :-)