-
-
Notifications
You must be signed in to change notification settings - Fork 218
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(#9544): add offline freetext search indexes #9661
base: master
Are you sure you want to change the base?
Conversation
initialReplicationLib.isReplicationNeeded(localDb, userCtx), | ||
swRegistration, | ||
setReplicationId(POUCHDB_OPTIONS, localDb), | ||
offlineDdocs.init(localDb) |
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.
This is the only real change here. The rest is just a quick re-factor to use async/await.
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.
These changes in shared-libs/search
are just temporary. The proper changes will need to be made against the cht-datasource code once we re-base on top of that.
This is why I have not added any additional unit tests to cover this logic (or worried too much about code structure).
|
||
describe('contacts_by_freetext', () => { | ||
[ | ||
['online view', loadView('medic-db', 'medic-client', 'contacts_by_freetext')], |
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.
We will need to remove this once the medic-client/contacts_by_freetext
view is deleted, but for now I thought it was useful to keep this in here to prove that the new offline indexes behave exactly the same as the original ones.
c.c. @m5r and @tatilepizs Particularly regarding how I have updated the e2e search tests to run both for an online and an offline user. I think this means these same tests can cover the offline indexes and the new Lucene functionality. 👍 |
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.
This bootstrapper code gets run during the main initialization of the app (before any of the Angular code spins up. This bootstrapping gets run during initial login and also when reloading the app (e.g. when the webapp-code/app-settings/ddocs change).
So, any time in the future when we make updates/additions/removals of views here, we can be confident that everything will be initialized properly in the local db when the app reloads.
await initialReplicationLib.replicate(remoteDb, localDb); | ||
if (await initialReplicationLib.isReplicationNeeded(localDb, userCtx)) { |
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: I might be missing something here but is this doing replication first then checking if replication is needed?
['health_center', 1], | ||
['clinic', 2], | ||
['person', 3], | ||
].forEach(([type, typeIndex]) => it('emits numerical index for default type', () => { |
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.
['contact', 2, 'clinic'], | ||
['contact', 3, 'person'] | ||
].forEach(([type, typeIndex, contactType]) => it( | ||
'emits numerical index for default type when used as custom type', |
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.
same comment as above
|
||
after(commonPage.logout); | ||
|
||
it('search by NON empty string should display results with contains match and clears search', 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.
it('search by NON empty string should display results with contains match and clears search', async () => { | |
it('search by NON empty string should display results which contains match and clears search', async () => { |
const sittuHealthCenter = placeFactory.place().build({ | ||
name: 'Sittu Health Center', | ||
type: 'health_center', | ||
parent: { _id: districtHospitalId, parent: { _id: '' } } | ||
}); | ||
|
||
const potuHospital = placeFactory.place().build({ | ||
name: 'Potu Hospital', | ||
type: 'district_hospital', | ||
parent: { _id: '', parent: { _id: '' } } | ||
const potuHealthCenter = placeFactory.place().build({ |
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: what's a sittu
and potu
?
Description
Closes #9544
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.