Skip to content
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

resources: Added search boost for gem5 versions #12

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading