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) »
  • advanced search yields same result set regardless of operator (and/or)
Pages: [1]

Author Topic: advanced search yields same result set regardless of operator (and/or)  (Read 738 times)

ctarascio

  • I post frequently
  • ***
  • Posts: 334
  • Karma: 30
    • American Friends Service Committee
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 6.26
  • MySQL version: 5.5.20
  • PHP version: 5.3.13
advanced search yields same result set regardless of operator (and/or)
September 28, 2011, 06:57:49 am
hi,
using advanced search, i did the following on both our 3.4.5 version and on the demo site and received the same results:

--advanced search with "and" operator for group=newsletter subscribers yielded 60 records
--edit the search criteria and add the summer program volunteers as second group yields 75 records
--but if you view the record for e.g. mrs fraddie j adams sr, she only has one group=newsletter subscribers
--changing the operator from and to or yields 75 records

so it seems like the "and" operator is being treated as "or". is this the expected behavior or is something wrong with the code? if the latter may i post a bug report in the issue tracker?

thanks,
cynthia

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: advanced search yields same result set regardless of operator (and/or)
September 28, 2011, 07:21:08 am

The AND/OR operator is across the various form elements. Within each form element the current code was used (based on the MIH spec and what was feasible for the number of hours)

So for groups, its always an OR. An AND is significantly more complex and will require a lot more code (maybe even a different query construction). There is an Include / Exclude groups / tags custom search that folks should use if u want to find contacts that belong to all groups (yes its more limited than advanced search)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • advanced search yields same result set regardless of operator (and/or)

This forum was archived on 2017-11-26.