Wild Cards in Searches and, more importantly, Caching (?) Results.
Dear Zendesk Experts,
Thanks again for previous advice, and I hope you may kindly help me again.
My latest queries are:
a) Wildcards don't seem to work in API calls.
Neither of the following bring back any users named David. (Though if I add the 'd' to the end, both work fine.)
/api/v2/search.json?query=type:user%20Davi*&sort_by=name&sort_order=asc
/api/v2/search/export.json?query=%22*Davi*%22&sort_by=name&sort_order=asc&page%5Bsize%5D=1000&filter%5Btype%5D=user
b) API results seem to randomly bring back deleted records.
I am using API calls similar to those in part (a). I then display the results in a table, something like this:
{{#each users}}
<tr>
<td>{{name}}</td>
<td>{{role}}</td>
</tr>
{{/each}}
If I click the search button on my app interface, then it calls the API and brings back the users. But sometimes it includes users that have been deleted and have shown on previous searches. It can give old results even after it has shown correct results.
I wonder if the results are being cached somewhere, and how I may clear the cache so that the users are always current.
Help appreciated.
Thanks,
SGL
-
Hi SGL! Regarding the question about wildcard searches, this behavior is expected. Wildcard searches can be incredibly taxing on a system, so we limit the functionality to property keywords. If you wanted to search for a user with a specific name + the ability to wildcard a portion of it, you can reference this part of the above article and utilize the "name" property to do so.
For the second question, how long is this behavior occurring after the user has been deleted? If the record was deleted within a couple of minutes, we may be returning cached results. Our cache is set to a max of 60 seconds, although there are some additional nuances that means that it is technically possible (although rare) that you may receive cached results for up to 3 minutes. Those additional nuances are why you may first see the correct results and then afterwards see a cached response...it is rare, but as you saw, definitely possible. We do not have a mechanism to bypass cached results.
Let me know if you're seeing deleted/cached response after 3 minutes in your searches and we can investigate further what may be going on.
-
Thanks Greg,
Ok, the wildcard thing is fine. But I forgot to mention that the sort elements of the query don't seem to work either. Is this also normal behaviour in this context?
Also, I think that the cache is cleared after a minute or so. It can give different combinations of deleted users until it clears, but I think I can chalk that up as a quirk. I can probably put something in the code to mitigate the effect.
Thanks,
SGL.
-
I just want to add: when the mystery deleted users are returned by the API (apparently from the cache) they have id, name, organisation and role details, but their email addresses are null. So, I can filter them from the array of search results where the email is null.
Thanks,
SGL.
Please sign in to leave a comment.
3 Comments