Skip to content

Commit

Permalink
resources: Added search boost for gem5 versions (#12)
Browse files Browse the repository at this point in the history
- Search score will be boosted by 10 times if the resource is compatible
with the gem5 version mentions

Note: As this is static the gem5 version needs to be updated every
release
  • Loading branch information
Harshil2107 authored Sep 12, 2024
1 parent 16a8a58 commit e6bf22f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gem5.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,6 @@
"metadata": {}
}
}
}
},
"gem5_version": "24.0"
}
1 change: 1 addition & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = {
BASE_PATH: basePath,
SOURCES: config.config.sources,
TABS: config.ui.tabs,
GEM5_VERSION: config.gem5_version
},
webpack: (config) => {
config.module.rules.push({
Expand Down
14 changes: 14 additions & 0 deletions pages/api/mongodb/getResourcesByQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ function getLatestVersionPipeline() {
* @returns {Array} - An array representing the MongoDB aggregation pipeline to perform text search.
*/
function getSearchPipeline(queryObject) {
// getting current gem5_version to boost search for resources compatible with latest gem5 release
const gem5_version = process.env.GEM5_VERSION;

let pipeline = [
{
$search: {
Expand All @@ -127,6 +130,17 @@ function getSearchPipeline(queryObject) {
},
},
},
{
text: {
path: "gem5_versions",
query: gem5_version,
score: {
boost: {
value: 10,
},
},
},
}
],
must: [
{
Expand Down

0 comments on commit e6bf22f

Please sign in to comment.