Body: <p>The same user has seen contact search results return differently for identical criteria even though relevant data has not changed.</p>
  <p><strong>The mysterious behavior:</strong></p>
  <p>The site administrator (&quot;user A&quot;) reports this odd situation:</p>
  <ol>
  <li><p>On a given day (&quot;day 1&quot;), she searched for contacts named like '%kleberg%' and got 2 results:
  <a href="https://i.sstatic.net/f8x57.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/f8x57.png" alt="enter image description here" /></a>
  (This is a user-provided screenshot of exactly what she saw at the time.)</p>
  </li>
  <li><p>At that moment, she was on a call with another staff member (&quot;user B&quot;) who observed 16 results for the same criteria. Next day (&quot;day 2&quot;), and any day since, user A searches with the same criteria and also gets 16 results (cropped):
  <a href="https://i.sstatic.net/28Vkk.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/28Vkk.png" alt="enter image description here" /></a></p>
  </li>
  </ol>
  <p><strong>Additional details:</strong></p>
  <ul>
  <li>Both user A and user B have (and always have had) &quot;Administrator&quot; role, therefore have all permissions in CiviCRM.</li>
  <li>I have been unable to reproduce the &quot;day 1&quot; behavior even when logged in as user A. Likewise, user A cannot reproduce this behavior.</li>
  <li>CiviCRM extensions and WP plugins remain unchanged since &quot;day 1&quot;.</li>
  <li>WordPress 6.2.2; CiviCRM 5.65.1</li>
  </ul>
  <p><strong>Question:</strong></p>
  <p>What could cause this kind of inconsistent behavior in contact search results? Some caching mechanism? Some issue with MySQL? Something else?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-01-30T20:28:42.610Z
Comments.Text: May be ACL or custom code?
Comments.UserDisplayName: Pradeep Nayak
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-01-30T23:13:15.673Z
Comments.Text: Yeah it sounds like something I've seen before with the ACL contact cache. It makes search results seem not up to date sometimes. Take a read here and maybe you have set one of them or can play with these settings: https://docs.civicrm.org/sysadmin/en/latest/setup/optimizations/#smart-group-and-acl-performance
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-01-31T03:40:26.810Z
Comments.Text: Pradeep Nayak, Demerit : I'm under the impression that ACLs don't apply if user has "edit all contacts", and since this user has WP "Administrator" role, they have all permissions including that one. So would ACLs even be relevant here?
Comments.UserDisplayName: TwoMice
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-01-31T15:57:48.597Z
Comments.Text: Do you have any sort of additional caching layers in the workflow? Could the first instance have been from some a stale query? Just speculating. Is this a one time thing or have there been other reports of result differences?
Comments.UserDisplayName: zip
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-01-31T21:53:39.983Z
Comments.Text: zip: No, there's no additional caching on this site (e.g. WP cache plugins, redis). Also no other known search result differences (though of course it's rare that users would know if it's happening -- after all, the search results should be authoritative, so they don't typically compare.)
Comments.UserDisplayName: TwoMice
Tags: <search-results>
Title: Contact search results inconsistent -- what could cause this?
ThreadText: # Contact search results inconsistent -- what could cause this?
  
  (Asked by: username_0 on 2024-01-30)
  
  The same user has seen contact search results return differently for identical criteria even though relevant data has not changed.
  
  **The mysterious behavior:**
  
  The site administrator ("user A") reports this odd situation:
  
  1. On a given day ("day 1"), she searched for contacts named like '%kleberg%' and got 2 results:
     [![enter image description here](https://i.sstatic.net/f8x57.png)](https://i.sstatic.net/f8x57.png)
     (This is a user-provided screenshot of exactly what she saw at the time.)
  2. At that moment, she was on a call with another staff member ("user B") who observed 16 results for the same criteria. Next day ("day 2"), and any day since, user A searches with the same criteria and also gets 16 results (cropped):
     [![enter image description here](https://i.sstatic.net/28Vkk.png)](https://i.sstatic.net/28Vkk.png)
  
  **Additional details:**
  
  * Both user A and user B have (and always have had) "Administrator" role, therefore have all permissions in CiviCRM.
  * I have been unable to reproduce the "day 1" behavior even when logged in as user A. Likewise, user A cannot reproduce this behavior.
  * CiviCRM extensions and WP plugins remain unchanged since "day 1".
  * WordPress 6.2.2; CiviCRM 5.65.1
  
  **Question:**
  
  What could cause this kind of inconsistent behavior in contact search results? Some caching mechanism? Some issue with MySQL? Something else?
  
  **Tags:** search-results
  
  > **Comments:**
  > **username_1**: May be ACL or custom code?  
  > **username_2**: Yeah it sounds like something I've seen before with the ACL contact cache. It makes search results seem not up to date sometimes. Take a read here and maybe you have set one of them or can play with these settings: https://docs.civicrm.org/sysadmin/en/latest/setup/optimizations/#smart-group-and-acl-performance  
  > **username_0**: username_1, username_2 : I'm under the impression that ACLs don't apply if user has "edit all contacts", and since this user has WP "Administrator" role, they have all permissions including that one. So would ACLs even be relevant here?  
  > **username_3**: Do you have any sort of additional caching layers in the workflow? Could the first instance have been from some a stale query? Just speculating. Is this a one time thing or have there been other reports of result differences?  
  > **username_0**: zip: No, there's no additional caching on this site (e.g. WP cache plugins, redis). Also no other known search result differences (though of course it's rare that users would know if it's happening -- after all, the search results should be authoritative, so they don't typically compare.)  
  
  ---
  
  ## 0 answers
  
  