Skip to content

Commit

Permalink
Only boost on popularity for all, title, or contrib searches
Browse files Browse the repository at this point in the history
  • Loading branch information
nonword committed Jul 29, 2024
1 parent 746437c commit 960bdcd
Show file tree
Hide file tree
Showing 20 changed files with 277,537 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -1331,10 +1331,12 @@ const buildElasticQuery = function (params) {
}
})

// Boost popular bibs:
query.bool.should.push({ range: { popularity: namedQuery({ gte: 5, boost: 100 }, 'popularity 1') } })
query.bool.should.push({ range: { popularity: namedQuery({ gte: 10, boost: 200 }, 'popularity 2') } })
query.bool.should.push({ range: { popularity: namedQuery({ gte: 20, boost: 500 }, 'popularity 3') } })
if (['all', 'title', 'contributor'].includes(params.search_scope)) {
// Boost popular bibs:
query.bool.should.push({ range: { popularity: namedQuery({ gte: 5, boost: 100 }, 'popularity 1') } })
query.bool.should.push({ range: { popularity: namedQuery({ gte: 10, boost: 200 }, 'popularity 2') } })
query.bool.should.push({ range: { popularity: namedQuery({ gte: 20, boost: 500 }, 'popularity 3') } })
}

// Build a version of the query without quotes, if used, since the quote
// character will not be in the literal value:
Expand Down
Loading

0 comments on commit 960bdcd

Please sign in to comment.