2

Have discovered recently while searching for multiple tags. Even if Search operator radio button AND selected, search for two tags returns results with OR logic. Mean, there is a contact, which has several tags assigned; search by selecting, say, two tags contact has, returns contacts tagged by one of tags, not both of them. Double- and triple-checked. Sounds like a bug, but not entirely sure, since no similar complains found. Will anyone with similar setup (mean, contacts with multiple tags), confirm it works / doesn't work, please.

2
  • You can check this yourself easily by using one of the Demo sites
    – petednz - fuzion
    Mar 24, 2016 at 18:44
  • Oh, sorry, forgot about this option; have just checked at one of demo sites.and indeed, AND is not AND for multiple tags search.
    – yurg
    Mar 25, 2016 at 9:49

1 Answer 1

1

I think the AND operator applies between fields, not within options of a field. If you want to search TagX AND TagY you can do this in Search Builder.

3
  • You're right, it's probably my misunderstanding of GUI elements placement: since AND/OR switch is located inside "Basic Criteria" fieldset, it looks so logical it covers fields inside this fieldset. I think also, help note, attached to AND/OR switch states the same: nimbus.everhelper.me/client/notes/share/428744/…
    – yurg
    Mar 25, 2016 at 9:53
  • Have tried to use an API for search by tag(s); have got an error (had to cut full sql query due to comment length restriction): "no such field", "sql": "SELECT contact_a.id as contact_id ... FROM civicrm_contact contact_a LEFT JOIN civicrm_entity_tag civicrm_entity_tag-Belgium ON ( civicrm_entity_tag-Belgium.entity_id = contact_a.id AND civicrm_entity_tag-Belgium.entity_table = 'civicrm_contact') WHERE ( contact_a.is_deleted = '0' AND civicrm_entity_tag-Belgium.tag_id IN (Belgium) ) [nativecode=1054 ** Unknown column 'Belgium' in 'where clause']",
    – yurg
    Mar 29, 2016 at 9:55
  • 1
    The AND/OR was moved out of Basic Citeria in 4.7. The Search Criteria help note states: "When multiple options are selected within a search field the selections are combined using OR criteria (e.g. selecting both 'Group A' and 'Group B' will find contacts who are either in 'Group A' OR 'Group B' or in both). By default the different search fields are combined using the AND Search Operator (e.g. selecting Tag is 'Age' AND Country is 'Canada' returns only those contacts who meet both criteria). You can override the Search Operator default for combining different fields in the Search Settings."
    – JoAnne
    Apr 24, 2016 at 12:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.