-
Notifications
You must be signed in to change notification settings - Fork 535
Added new static facet to show metadata blocks with values #8793
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
Merged
kcondon
merged 6 commits into
IQSS:develop
from
abujeda:8535-new-static-facet-show-metadata-blocks
Aug 18, 2022
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
112c233
Added new static facet to show metadata blocks with values
abujeda c3aa899
Added Update/Delete commands for metadata block facets
abujeda e84ceee
Updated metadata block facet DB script after 5.11 release
abujeda 12f5192
Updated Metadata block facet API with new requirements
abujeda f3d2ee1
Updated updateMetadataBlockFacetRoot API to only update when there is…
abujeda 34f64cd
Improved Documentation for Metadata Blocks Facet API
abujeda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| ## Adding new static search facet: Metadata Types | ||
| A new static search facet has been added to the search side panel. This new facet is called "Metadata Types" and is driven from metadata blocks. When a metadata field value is inserted into a dataset, an entry for the metadata block it belongs to is added to this new facet. | ||
|
|
||
| This new facet needs to be configured for it to appear on the search side panel. The configuration assigns to a dataverse what metadata blocks to show. The configuration is inherited by child dataverses. | ||
|
|
||
| To configure the new facet, use the Metadata Block Facet API: <https://guides.dataverse.org/en/latest/api/native-api.html#set-metadata-block-facet-for-a-dataverse-collection> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ["authorName", "authorAffiliation"] |
1 change: 1 addition & 0 deletions
1
doc/sphinx-guides/source/_static/api/metadata-block-facets.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ["socialscience", "geospatial"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
src/main/java/edu/harvard/iq/dataverse/DataverseMetadataBlockFacet.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| package edu.harvard.iq.dataverse; | ||
|
|
||
| import javax.persistence.Entity; | ||
| import javax.persistence.GeneratedValue; | ||
| import javax.persistence.GenerationType; | ||
| import javax.persistence.Id; | ||
| import javax.persistence.Index; | ||
| import javax.persistence.JoinColumn; | ||
| import javax.persistence.ManyToOne; | ||
| import javax.persistence.Table; | ||
| import java.io.Serializable; | ||
| import java.util.Objects; | ||
|
|
||
| /** | ||
| * | ||
| * @author adaybujeda | ||
| */ | ||
| @Entity | ||
| @Table(indexes = {@Index(columnList="dataverse_id") | ||
| , @Index(columnList="metadatablock_id")}) | ||
| public class DataverseMetadataBlockFacet implements Serializable { | ||
| private static final long serialVersionUID = 1L; | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| private Long id; | ||
|
|
||
| @ManyToOne | ||
| @JoinColumn(name = "dataverse_id") | ||
| private Dataverse dataverse; | ||
|
|
||
| @ManyToOne | ||
| @JoinColumn(name = "metadatablock_id") | ||
| private MetadataBlock metadataBlock; | ||
|
|
||
| public Long getId() { | ||
| return id; | ||
| } | ||
|
|
||
| public void setId(Long id) { | ||
| this.id = id; | ||
| } | ||
|
|
||
| public Dataverse getDataverse() { | ||
| return dataverse; | ||
| } | ||
|
|
||
| public void setDataverse(Dataverse dataverse) { | ||
| this.dataverse = dataverse; | ||
| } | ||
|
|
||
| public MetadataBlock getMetadataBlock() { | ||
| return metadataBlock; | ||
| } | ||
|
|
||
| public void setMetadataBlock(MetadataBlock metadataBlock) { | ||
| this.metadataBlock = metadataBlock; | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| int hash = 0; | ||
| hash += (this.id != null ? this.id.hashCode() : 0); | ||
| return hash; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object object) { | ||
| if (!(object instanceof DataverseMetadataBlockFacet)) { | ||
| return false; | ||
| } | ||
| DataverseMetadataBlockFacet other = (DataverseMetadataBlockFacet) object; | ||
| return !(!Objects.equals(this.id, other.id) && (this.id == null || !this.id.equals(other.id))); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return String.format("edu.harvard.iq.dataverse.DataverseMetadataBlockFacet[ id=%s ]", id); | ||
| } | ||
|
|
||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be set to false when you create a new Dataverse? Also for the root dataverse do we need to set it to true - since it doesn't have an owner? And it seems as if the only way to get a child dataverse to not inherit facets from its parent would be to give it its own facets via the api, correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be
falseby default. Because it is a boolean primitive, the default value isfalse. I was following the same pattern as withmetadataBlockRootandfacetRoot.As for the root dataverse, technically, there is no need to set it to
truebecause of the waygetMetadataBlockFacetRootwas coded (checking for the owner). But ifmetadataBlockRootand others are set totruein the root dataverse, then I guess it should be.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sekmiller are you happy with the explanation?
Do you want me to change anything regarding
metadataBlockFacetRoot?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adaybujeda - yes, sorry I was away for a few days. I just want to do another pass through the code, but I will probably send it along to QA shortly.