# Getting funny results when using UserClient.GetAllAsync

**URL:** <https://community.auth0.com/t/getting-funny-results-when-using-userclient-getallasync/9861>\
**Category:** Get Help\
**Tags:** user-management, .net, management-api\
**Created:** [March 7, 2018, 10:39pm UTC](https://community.auth0.com/t/getting-funny-results-when-using-userclient-getallasync/9861 "2018-03-07T22:39:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dean.ashton](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dean.ashton/32/10347_2.png) [@dean.ashton](https://community.auth0.com/u/dean.ashton)\
**Post date:** [March 7, 2018, 10:39pm UTC](https://community.auth0.com/t/getting-funny-results-when-using-userclient-getallasync/9861/1 "2018-03-07T22:39:56Z")

</div>

Hi everyone, I am getting funny results when searching for users. I am using the .Net Auth0 component to do the searching using the UserClient’s GetAllAsync method.

Users I have in Auth0:  
[scooby.doo@travelctm.com](mailto:scooby.doo@travelctm.com)  
[scooby.doo1@travelctm.com](mailto:scooby.doo1@travelctm.com)  
[andy.layzell@travelctm.com](mailto:andy.layzell@travelctm.com)

I am searching by email:

- When I pass in “scooby” or “scooby\*” as my search term, I get zero results, when I expected 2 results.
- When I pass in “scooby.doo” or “scooby.doo\*”, I get 1 result: [scooby.doo@travelctm.com](mailto:scooby.doo@travelctm.com). I expected 2 results.
- When I pass in “scooby.doo1” or “scooby.doo1\*”, I get 1 result: [scooby.doo1@travelctm.com](mailto:scooby.doo1@travelctm.com). This worked.
- When I pass in “andy” or “andy\*”, I get zero results, when I expected 1 result.
- When I pass in “andy.layzell” or “andy.layzell\*”, I get 1 result: [andy.layzell@travelctm.com](mailto:andy.layzell@travelctm.com).

Can anyone explain this behaviour?

```
    private string BuildLucerneQueryText(IUserFilter filter)
    {
        var searchQuery = "";

        if (!string.IsNullOrEmpty(filter.Email))
        {
            searchQuery = $" OR email:\"{filter.Email}*\"";
        }

        if (!string.IsNullOrEmpty(filter.Name))
        {
            searchQuery = $" OR name:\"{filter.Name}*\"";
        }

        if (!string.IsNullOrEmpty(filter.UserId))
        {
            searchQuery = $" OR user_id:\"{filter.UserId}*\"";
        }

        if (!string.IsNullOrEmpty(filter.Username))
        {
            searchQuery = $" OR username:\"{filter.Username}*\"";
        }

        //remove the leading text " OR " 
        if (!string.IsNullOrEmpty(searchQuery) && searchQuery.Substring(0,4) == " OR ") 
        {
            searchQuery = searchQuery.Substring(4);
        }

        //result will be searchQuery = email:"andy*"
        return searchQuery.Trim();
    }

    public async Task<IList<UserModel>> GetAsync(IUserFilter filter)
    {
        var users = new List<UserModel>();
        var token = GetAccessToken();
        var apiClient = new ManagementApiClient(token, managementApiUri);
        var filterText = BuildLucerneQueryText(filter);
        if (!string.IsNullOrEmpty(filterText))
        {
            var apiUsers = await apiClient.Users.GetAllAsync(null, null, null, null, null, null, null, filterText, "v2");
            users = apiUsers.Select(u => userModelMapper.Map(u)).ToList();
        }
        return users;
    }

```

---

<div class="post-metadata">

**Author:** ![James.Morrison](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/james.morrison/32/13507_2.png) [@James.Morrison](https://community.auth0.com/u/James.Morrison)\
**Post date:** [December 17, 2018, 5:00pm UTC](https://community.auth0.com/t/getting-funny-results-when-using-userclient-getallasync/9861/2 "2018-12-17T17:00:47Z")

</div>

As it has been more than a few months since this topic was opened, and there has been no reply or further information provided as to the existence of the issue, we are closing this topic. Please don’t hesitate to create a new topic if this issue is still present, we would be happy to work with you to help find a resolution.

---

<div class="post-metadata">

**Author:** ![James.Morrison](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/james.morrison/32/13507_2.png) [@James.Morrison](https://community.auth0.com/u/James.Morrison)\
**Post date:** [December 17, 2018, 5:00pm UTC](https://community.auth0.com/t/getting-funny-results-when-using-userclient-getallasync/9861/3 "2018-12-17T17:00:50Z")

</div>


