CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Proximity search query bug when using smart groups
Pages: [1]

Author Topic: Proximity search query bug when using smart groups  (Read 794 times)

fen

  • I post frequently
  • ***
  • Posts: 216
  • Karma: 13
    • CivicActions
  • CiviCRM version: 3.3-4.3
  • CMS version: Drupal 6/7
  • MySQL version: 5.1/5.5
  • PHP version: 5.3/5.4
Proximity search query bug when using smart groups
February 14, 2012, 08:14:45 am
I have two smart groups that appear to be very similar (though I don't know their history, e.g., how the client created them):
Code: [Select]
id=28 (1030 contacts in group):
Contribution Date - greater than or equal to "November 1st, 2009 12:00 AM" ...AND...
Contribution Amount - greater than "500" AND less than "10000000"

id=34 (474 contacts in group):
Contribution Date - greater than or equal to "January 1st, 2010 12:00 AM" AND less than or equal to "December 31st, 2012 11:59 PM" ...AND...
Contribution Amount - greater than "1000" AND less than "10000000"
Turns out that proximity searches (at least appear to) work for id=34 but not for id=28.  After tuning on CIVICRM_DEBUG_LOG_QUERY I found that the proximity search query to find the contacts differ only in this line:
Code: [Select]
AND cgc.group_id = 34and discovered what could be the reason:
Code: [Select]
mysql> select count(*) from civicrm_group_contact where group_id=28 \G
*************************** 1. row ***************************
count(*): 0

mysql> select count(*) from civicrm_group_contact where group_id=34 \G
*************************** 1. row ***************************
count(*): 300
So the proximity search is pulling from a subset (300 of 474) of contacts in the id=34 smart group, but finds nothing for the id=28 smart group as there is nothing in the civicrm_group_contact table for that group.

In any case, this seems like a bug in the query (both in v3.4.8 and v4.1.beta3) and likely in other versions.  While it's bad that nothing shows up when doing the proximity search for id=28, it's almost worse that some but potentially not all results are returned for the id=34 smart group.

I do not have a solution at this time as I'm not sure where to pull an appropriate cache of smart group contacts from.

Update: created issue http://issues.civicrm.org/jira/browse/CRM-9669
« Last Edit: February 14, 2012, 08:31:35 am by fen »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Proximity search query bug when using smart groups

This forum was archived on 2017-11-26.