Skip to content
1 change: 0 additions & 1 deletion config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module.exports = {
PORT: process.env.PORT || 3000,
API_VERSION: process.env.API_VERSION || 'v5',
DEFAULT_PAGE_SIZE: process.env.DEFAULT_PAGE_SIZE || 1000,
MAX_ELASTIC_SEARCH_RECORDS_SIZE: process.env.MAX_ELASTIC_SEARCH_RECORDS_SIZE || 10000,
// used to properly set the header response to api calls for services behind a load balancer
API_BASE_URL: process.env.API_BASE_URL || `http://localhost:3000`,

Expand Down
18 changes: 1 addition & 17 deletions src/services/ResourceService.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,23 +446,7 @@ async function listChallengesByMember (memberId, criteria) {
}
})

let docs = {
hits: {
total: 0,
hits: []
}
}

if (perPage * page <= config.MAX_ELASTIC_SEARCH_RECORDS_SIZE) {
docs = await searchES(mustQuery, perPage, page)
} else {
throw new errors.BadRequestError(`
ES pagination params:
page ${page},
perPage: ${perPage}
exceeds the max search window:${config.MAX_ELASTIC_SEARCH_RECORDS_SIZE}`
)
}
const docs = await searchES(mustQuery, perPage, page)

// Extract data from hits
let result = _.map(docs.hits.hits, item => item._source)
Expand Down