-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected Response for FusionAuthClient#searchUsersByQuery
When Using sortFields
.
#96
Comments
@tabuckner can you share how you were able to get those values for email into your FusionAuth environment? Seems like you may have done this in importing the users. Any reason why you did the markdown text? |
@matt1hathcock It looks like there was some sort of formatting issue when copying the values from our email thread into this ticket. I've now updated the original comment with the correct responses from the SDK. |
As requested in our email thread, here's a code snippet that will yield the results I'm seeing. To note, I believe this code snippet will not provide much value as the issue seems to be environment related. Aside from that, there is still a strong chance that there is some sort of user error on my end. import { FusionAuthClient, Sort } from "@fusionauth/typescript-client";
const FA_API_KEY = "my-super-secret-API-key";
const FA_API_SERVER_URL = "my-super-secret-API-server-url";
const FA_RESULT_SIZE = 5;
const myFAClient = new FusionAuthClient(FA_API_KEY, FA_API_SERVER_URL);
const testCase1Params = {
search: {
queryString: "*",
accurateTotal: true,
numberOfResults: FA_RESULT_SIZE,
},
};
const testCase2Params = {
search: {
queryString: "*",
accurateTotal: true,
numberOfResults: FA_RESULT_SIZE,
sortFields: [{ name: "email", order: Sort.asc }],
},
};
const test = async () => {
const testCase1 = await myFAClient.searchUsersByQuery(testCase1Params);
const testCase2 = await myFAClient.searchUsersByQuery(testCase2Params);
console.warn(testCase1.response.total === testCase2.response.total); // false
};
test(); |
Summary
There might be some sort of configuration step that I've overlooked, or some sort of misunderstanding in how things are supposed to work. I'm running into a strange issue wherein adding a value to the parameter object for
FusionAuthClient#searchUsersByQuery
yields a result set smaller than the same query omittingsortFields
.I had a call with our sales engineer, and we've sent a few emails, but they've now suggested that I open a ticket in the TS repo.
Expected Behavior
Each of the specified parameter values should result in a result set size of 5. When providing the
sortFields
the results should be sorted accordingly, assuming the provided values are valid.Actual Behavior
Adding
sortFields
to an existing{ search }
parameter property yields a result set that is smaller than the same{ search }
without thesortFields
.Copied Notes from Email Thread with Sales Engineering
Scenario 1 - Wildcard Query w/o Sort Fields
searchUsersByQuery Param Object
Result
NOTES
In this example I get a total count of 31, and a full page of results with the page size I requested. However, when passing a similar param object to searchUsersByQuery that introduces "sortFields", the results are changed in an unexpected way.
Scenario 2 - Wildcard Query w/ Sort Fields
searchUsersByQuery Param Object
Result
Expected
I would see the >2 records as the result of this query, presumably sorted by the supplied field. Previously, without the sortFields property, I was able to retrieve >2 records from Fusion Auth. Somehow, introducing the "sortField" has 'filtered' the results to only return 2 of the reported 31 records. Without the sortField, I'm able to retrieve the expected records.
Specifications
Video of Issue
Kapture.2024-01-03.at.09.38.00.mp4
NOTE
Note that the only difference is introducing the
sortFields
property. Is the issue the sort direction? I believe it's a string enum, so I assumed passing the string value assigned in the enum is fine. Perhaps that's the issue?The text was updated successfully, but these errors were encountered: