Skip to content

Commit e6bf22f

Browse files
authored
resources: Added search boost for gem5 versions (#12)
- 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
1 parent 16a8a58 commit e6bf22f

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

gem5.config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,6 @@
121121
"metadata": {}
122122
}
123123
}
124-
}
124+
},
125+
"gem5_version": "24.0"
125126
}

next.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports = {
2626
BASE_PATH: basePath,
2727
SOURCES: config.config.sources,
2828
TABS: config.ui.tabs,
29+
GEM5_VERSION: config.gem5_version
2930
},
3031
webpack: (config) => {
3132
config.module.rules.push({

pages/api/mongodb/getResourcesByQuery.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ function getLatestVersionPipeline() {
111111
* @returns {Array} - An array representing the MongoDB aggregation pipeline to perform text search.
112112
*/
113113
function getSearchPipeline(queryObject) {
114+
// getting current gem5_version to boost search for resources compatible with latest gem5 release
115+
const gem5_version = process.env.GEM5_VERSION;
116+
114117
let pipeline = [
115118
{
116119
$search: {
@@ -127,6 +130,17 @@ function getSearchPipeline(queryObject) {
127130
},
128131
},
129132
},
133+
{
134+
text: {
135+
path: "gem5_versions",
136+
query: gem5_version,
137+
score: {
138+
boost: {
139+
value: 10,
140+
},
141+
},
142+
},
143+
}
130144
],
131145
must: [
132146
{

0 commit comments

Comments
 (0)