-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
feat(9586): implement freetext search in cht datasource #9625
base: master
Are you sure you want to change the base?
feat(9586): implement freetext search in cht datasource #9625
Conversation
eba7aac
to
43efbef
Compare
…text-search-in-cht-datasource
…text-search-in-cht-datasource
Co-authored-by: Joshua Kuestersteffen <[email protected]>
…thub.com:medic/cht-core into 9586-implement-freetext-search-in-cht-datasource
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets 👏 freaking 👏 go 👏 !!!!! 🚀 🚀
Thanks @sugat009 for hanging in with me on this absolute tour-de-force! 💪
YYYYYYYYEEEESSS!!! you two are amazing - so great to see this work come together |
Co-authored-by: Joshua Kuestersteffen <[email protected]>
Co-authored-by: Joshua Kuestersteffen <[email protected]>
Co-authored-by: Joshua Kuestersteffen <[email protected]>
const expectedContactIds = [ contact0._id, contact1._id, contact2._id ]; | ||
// NOTE: adding a limit of 4 to deliberately fetch 4 contacts with the given search word | ||
// and enforce re-fetching logic | ||
const responsePage = await getUuidsPage(Qualifier.byFreetext(searchWord), null, 4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please use a limit that is lower than the amount of contacts that we expect to receive?
expect(responseCursor).to.be.equal(null); | ||
}); | ||
|
||
it('returns a page of people for stringified limit and null cursor passed', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Does person
also have a getWithLineage
option? If yes, can you please add a test for that as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already a test for that.
it('returns the person with lineage when the withLineage query parameter is provided', async () => { |
However, it's inside the get
suite to match the api/controller
integration test pattern. I could move it to its own getByLineage
suite.
const expectedContactIds = [ report6._id, report7._id, report8._id ]; | ||
// NOTE: adding a limit of 4 to deliberately fetch 4 contacts with the given search word | ||
// and enforce re-fetching logic | ||
const responsePage = await getUuidsPage(Qualifier.byFreetext(searchWord), null, 4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Can you please use a lower limit than number of results we expect?
I misclicked and submitted the review without a message 😅 I think this is epic work @sugat009 . All my suggestions are small quality of life things or readability or test coverage things. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!!! Just one tiny request about adding the test with the lower limit. I think it's really important to add this test, as this can be a majority of requests that make up freetext searches. We should display that pagination works correctly.
const place = await getPlace(Qualifier.byUuid('invalid-uuid')); | ||
expect(place).to.be.null; | ||
}); | ||
it( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about a place that has no parent and no primary contact?
// and enforce re-fetching logic | ||
const queryParams = { | ||
freetext: searchWord, | ||
limit: 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I saw a test that added this and that it was later removed?
// and enforce re-fetching logic | ||
const queryParams = { | ||
freetext: searchWord, | ||
limit: 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should still add the test, and check that the results are a subset of the list of possible results.
Sure, will do.
Yeah. I've already written the test. I was planning on waiting on the approval before I pushed it mistakenly 😅. |
Description
Closes: #9586
Code review checklist
Compose URLs
If Build CI hasn't passed, these may 404:
License
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.