janastu / iihs_curation_dashboard

Front end dashboard to curate newsrack feeds using angular 4
Other
2 stars 4 forks source link

Slow loading issue #260

Closed salus-sage closed 6 years ago

salus-sage commented 6 years ago

refer to puch db doc query https://pouchdb.com/2014/06/17/12-pro-tips-for-better-code-with-pouchdb.html pont no. 9 suggestion: instead of map reduce, below syntax to be used for querying.

var ddoc = createDesignDoc('by_timestamp', function (doc) {
  emit(doc.timestamp, doc.name);
});
db.put(ddoc).then(function() {/* etc. */});

function getPostsSince(when) {
  return db.query('by_timestamp', {endkey: when, descending: true});
}
function getPostsBefore(when) {
  return db.query('by_timestamp', {startkey: when});
}
function getPostsBetween(startTime, endTime) {
  return db.query('by_timestamp', {startkey: startTime, endkey: endTime});
}

`

salus-sage commented 6 years ago

this upgrade is added in recent commits, issue should be resolved. awaiting confirmation from testing

vaishnavisv commented 6 years ago

By emitting the necessary properties and not the whole doc , the slow loading issue is resolved now