Skip to content

[PROD] - Talent search - unresponsive UI fix #204

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

Merged
merged 11 commits into from
Jul 8, 2025
Merged
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ workflows:
- feature/profile_nudge
- TAL-77
- es_fix
- pm-1448

# Production builds are exectuted only on tagged commits to the
# master branch.
Expand Down
32 changes: 6 additions & 26 deletions src/common/eshelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,13 @@ async function getSuggestion (query, esClient, currentUser) {
*/
async function searchMembersSkills (skillIds, skillsBooleanOperator, page, perPage, esClient) {
const searchResults = {hits:{hits:[]}}
const responseQueue = []

// construct ES query for members skills
const esQuerySkills = {
index: config.get('ES.MEMBER_PROFILE_ES_INDEX'),
type: config.get('ES.MEMBER_PROFILE_ES_TYPE'),
size: 10000,
scroll: '90s',
size: perPage,
from: (page - 1) * perPage,
_source:[
'userId',
'description',
Expand Down Expand Up @@ -374,29 +373,10 @@ async function searchMembersSkills (skillIds, skillsBooleanOperator, page, perPa
const response = config.get("ES.OPENSEARCH") == "false"
? await esClient.search(esQuerySkills)
: (await esClient.search(esQuerySkills)).body;
responseQueue.push(response)

while (responseQueue.length) {
const body = responseQueue.shift()
// collect the titles from this response
body.hits.hits.forEach(function (hit) {
searchResults.hits.hits.push(hit)
})

// check to see if we have collected all of the quotes
if (body.hits.total === searchResults.hits.hits.length) {
searchResults.hits.total=body.hits.total
break
}

// get the next response if there are more quotes to fetch
responseQueue.push(
await esClient.scroll({
scroll_id: body._scroll_id,
scroll: '90s'
})
)
}
response.hits.hits.forEach(function (hit) {
searchResults.hits.hits.push(hit)
})
searchResults.hits.total=response.hits.total
return searchResults
}

Expand Down
2 changes: 1 addition & 1 deletion src/services/SearchService.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ const searchMembersBySkills = async (currentUser, query) => {
const esClient = await helper.getESClient()
let skillIds = await helper.getParamsFromQueryAsArray(query, 'id')
query.skillIds = skillIds
const result = searchMembersBySkillsWithOptions(currentUser, query, skillIds, BOOLEAN_OPERATOR.AND, query.page, query.perPage, query.sortBy, query.sortOrder, esClient)
const result = await searchMembersBySkillsWithOptions(currentUser, query, skillIds, BOOLEAN_OPERATOR.AND, query.page, query.perPage, query.sortBy, query.sortOrder, esClient)
return result
} catch (e) {
console.log("ERROR WHEN SEARCHING")
Expand Down