Answers.Body: <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-25T09:53:51.493Z
Answers.Text: 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: https://nimbus.everhelper.me/client/notes/share/428744/bxv59aazuvs42upqr90s
Answers.UserDisplayName: yurg
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-29T09:55:25.977Z
Answers.Text: 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']",
Answers.UserDisplayName: yurg
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-24T12:40:38.130Z
Answers.Text: 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."
Answers.UserDisplayName: JoAnne
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-24T21:46:27.790Z
Answers.LastActivityDate: 2016-03-24T21:46:27.790Z
Answers.UserDisplayName: petednz - fuzion
Body: <p>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.  </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-03-24T18:44:21.557Z
Comments.Text: You can check this yourself easily by using one of the Demo sites
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-03-25T09:49:45.693Z
Comments.Text: Oh, sorry, forgot about this option; have just checked at one of demo sites.and indeed, AND is not AND for multiple tags search.
Comments.UserDisplayName: yurg
Tags: <search><search-results><tags>
Title: Advanced Search AND Operator doesn't operate for Multiple Tags Search (at least)
ThreadText: # Advanced Search AND Operator doesn't operate for Multiple Tags Search (at least)
  
  (Asked by: username_0 on 2016-03-24)
  
  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.
  
  **Tags:** search, search-results, tags
  
  > **Comments:**
  > **username_1**: You can check this yourself easily by using one of the Demo sites  
  > **username_0**: Oh, sorry, forgot about this option; have just checked at one of demo sites.and indeed, AND is not AND for multiple tags search.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-03-24. Score: 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.
  
  > **Comments:**
  > **username_0**: 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: https://nimbus.everhelper.me/client/notes/share/428744/bxv59aazuvs42upqr90s  
  > **username_0**: 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']",  
  > **username_2**: 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."  
  
  ---
  
  