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

Feature NMH-65: Collect and use statistics on downloads of model #6835

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
13 changes: 11 additions & 2 deletions docs/_frontend/src/models/Sidebar/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,17 @@ const Sidebar = ({ meta, params, onSubmit }) => {
}}
>
<label>Sort By:</label>
<Radio value="date">Date</Radio>
<Radio value="views">Views</Radio>
<div className={styles.radioContainers}>
pabla marked this conversation as resolved.
Show resolved Hide resolved
<Radio value="date" className={styles.radio}>
Date
</Radio>
<Radio value="views" className={styles.radio}>
Views
</Radio>
<Radio value="downloads" className={styles.radio}>
Downloads
</Radio>
</div>
</RadioGroup>
</div>
</div>
Expand Down
8 changes: 8 additions & 0 deletions docs/_frontend/src/models/Sidebar/Sidebar.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@
.control:not(:last-child) {
margin-bottom: 20px;
}

.radioContainers {
flex-direction: column;
}

.radioContainers .radio {
display: block;
}
11 changes: 11 additions & 0 deletions docs/_plugins/search_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,15 @@ def is_latest?(group, model)
},
"url": {
"type": "keyword"
},
"download_link": {
"type": "keyword"
pabla marked this conversation as resolved.
Show resolved Hide resolved
},
"views": {
"type": "integer"
},
"downloads": {
"type": "integer"
}
}
}
Expand Down Expand Up @@ -341,6 +350,8 @@ def is_latest?(group, model)
model[:type] = models_json[model[:url]][:type]
# Add predicted entities to search models
model[:predicted_entities] = models_json[model[:url]][:predicted_entities]
# Add download_link to search models
model[:download_link] = models_json[model[:url]][:download_link]

if client
if force_reindex || uniq_for_indexing.include?(uniq)
Expand Down