forked from DSpace/DSpace
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Customize CLARIN-DSpace search facets. (#203)
* Added Community indexation * Fixed checkstyle violation * Add license header check and update signature * Added doc --------- Co-authored-by: MilanMajchrák <[email protected]>
- Loading branch information
1 parent
842af9b
commit a63fcbb
Showing
13 changed files
with
115 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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
69 changes: 69 additions & 0 deletions
69
dspace-api/src/main/java/org/dspace/discovery/ClarinSolrItemsCommunityIndexPlugin.java
This file contains 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,69 @@ | ||
/** | ||
* The contents of this file are subject to the license and copyright | ||
* detailed in the LICENSE and NOTICE files at the root of the source | ||
* tree and available online at | ||
* | ||
* http://www.dspace.org/license/ | ||
*/ | ||
package org.dspace.discovery; | ||
|
||
import java.sql.SQLException; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
import org.apache.commons.collections4.CollectionUtils; | ||
import org.apache.logging.log4j.Logger; | ||
import org.apache.solr.common.SolrInputDocument; | ||
import org.dspace.content.Collection; | ||
import org.dspace.content.Community; | ||
import org.dspace.content.Item; | ||
import org.dspace.core.Context; | ||
import org.dspace.discovery.indexobject.IndexableItem; | ||
|
||
/** | ||
* Plugin for indexing the Items community. It helps search the Item by the community. | ||
* | ||
* @author Milan Majchrak (milan.majchrak at dataquest.sk) | ||
*/ | ||
public class ClarinSolrItemsCommunityIndexPlugin implements SolrServiceIndexPlugin { | ||
|
||
private static final Logger log = org.apache.logging.log4j.LogManager | ||
.getLogger(ClarinSolrItemsCommunityIndexPlugin.class); | ||
|
||
@Override | ||
public void additionalIndex(Context context, IndexableObject indexableObject, SolrInputDocument document) { | ||
if (indexableObject instanceof IndexableItem) { | ||
Item item = ((IndexableItem) indexableObject).getIndexedObject(); | ||
|
||
String owningCommunity = this.getOwningCommunity(context, item); | ||
document.addField("items_owning_community", owningCommunity); | ||
} | ||
} | ||
|
||
private String getOwningCommunity(Context context, Item item) { | ||
if (Objects.isNull(item)) { | ||
return " "; | ||
} | ||
Collection owningCollection = item.getOwningCollection(); | ||
try { | ||
List<Community> communities = owningCollection.getCommunities(); | ||
if (CollectionUtils.isEmpty(communities)) { | ||
log.error("Community list of the owning collection is empty."); | ||
return " "; | ||
} | ||
|
||
// First community is the owning community. | ||
Community owningCommunity = communities.get(0); | ||
if (Objects.isNull(owningCommunity)) { | ||
log.error("Owning community is null."); | ||
return " "; | ||
} | ||
|
||
return owningCommunity.getName(); | ||
} catch (SQLException e) { | ||
log.error("Cannot getOwningCommunity for the Item: " + item.getID() + ", because: " + e.getSQLState()); | ||
} | ||
|
||
return " "; | ||
} | ||
} |
This file contains 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 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 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 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 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 |
---|---|---|
|
@@ -54,7 +54,7 @@ the email and the url is not on *.com domain and the part after schema:// is lon | |
##### HELP DESK ##### | ||
# `lr.help.mail` is exposed to the FE - must be set as exposed | ||
|
||
rest.properties.exposed = lr.help.mail,authentication-shibboleth.netid-header,authentication-shibboleth.email-header,authentication-shibboleth.firstname-header,authentication-shibboleth.lastname-header,dspace.name,versioning.item.history.include.submitter,statistics.cache-server.uri | ||
rest.properties.exposed = lr.help.mail,authentication-shibboleth.netid-header,authentication-shibboleth.email-header,authentication-shibboleth.firstname-header,authentication-shibboleth.lastname-header,dspace.name,versioning.item.history.include.submitter,statistics.cache-server.uri,dspace.ui.url | ||
lr.help.mail = [email protected] | ||
lr.help.phone = 0000 | ||
|
||
|
This file contains 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 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