Skip to content

Commit

Permalink
Remove contrib keyword matchers from 'all' search
Browse files Browse the repository at this point in the history
Also add relevance report to debug response
  • Loading branch information
nonword committed Jun 6, 2024
1 parent c0101a0 commit 4ca337f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,18 @@ module.exports = function (app, _private = null) {
return resp
})
.then((updatedResponse) => ResourceResultsSerializer.serialize(updatedResponse, opts))
.then((resp) => Object.assign(resp, { debug: { query: body } }))
.then((resp) => {
// Build relevance report (for debugging):
const relevanceReport = resp.itemListElement
.map((r) => `${r.searchResultScore}: ${r.result.title[0]}`)
app.logger.debug(`Relevances:\n ${relevanceReport.join('\n')}`)

resp.debug = {
relevanceReport,
query: body
}
return resp
})
})
}

Expand Down Expand Up @@ -1315,7 +1326,7 @@ const buildElasticQuery = function (params) {
}
])
}
if (['all', 'contributor'].includes(params.search_scope)) {
if (['contributor'].includes(params.search_scope)) {
query.bool.should = query.bool.should.concat([
{
match_phrase: {
Expand Down

0 comments on commit 4ca337f

Please sign in to comment.