[CST-5249] Other community feedbacks

This commit is contained in:
Luca Giamminonni
2022-04-26 16:40:14 +02:00
parent 714293cc9e
commit ba7d393ed2
22 changed files with 238 additions and 2311 deletions

View File

@@ -109,7 +109,8 @@ public class NBEntityOpenaireMetadataAction implements NBAction {
link(context, item, relatedItem); link(context, item, relatedItem);
} else { } else {
Collection collection = collectionService.retrieveCollectionByEntityType(context, item, entityType); Collection collection = collectionService.retrieveCollectionWithSubmitByEntityType(context,
item, entityType);
if (collection == null) { if (collection == null) {
throw new IllegalStateException("No collection found by entity type: " + collection); throw new IllegalStateException("No collection found by entity type: " + collection);
} }

View File

@@ -101,7 +101,8 @@ public class NBEventActionServiceImpl implements NBEventActionService {
* Make acknowledgement to the configured urls for the event status. * Make acknowledgement to the configured urls for the event status.
*/ */
private void makeAcknowledgement(String eventId, String source, String status) { private void makeAcknowledgement(String eventId, String source, String status) {
String[] ackwnoledgeCallbacks = configurationService.getArrayProperty(source + "-nbevents.acknowledge-url"); String[] ackwnoledgeCallbacks = configurationService
.getArrayProperty("nbevents." + source + ".acknowledge-url");
if (ackwnoledgeCallbacks != null) { if (ackwnoledgeCallbacks != null) {
for (String ackwnoledgeCallback : ackwnoledgeCallbacks) { for (String ackwnoledgeCallback : ackwnoledgeCallbacks) {
if (StringUtils.isNotBlank(ackwnoledgeCallback)) { if (StringUtils.isNotBlank(ackwnoledgeCallback)) {

View File

@@ -51,6 +51,10 @@ public class NBOpenaireMetadataMapAction implements NBAction {
@Override @Override
public void applyCorrection(Context context, Item item, Item relatedItem, NBMessageDTO message) { public void applyCorrection(Context context, Item item, Item relatedItem, NBMessageDTO message) {
if (relatedItem != null) {
throw new IllegalArgumentException("NBOpenaireMetadataMapAction does not support related item");
}
if (!(message instanceof OpenaireMessageDTO)) { if (!(message instanceof OpenaireMessageDTO)) {
throw new IllegalArgumentException("Unsupported message type: " + message.getClass()); throw new IllegalArgumentException("Unsupported message type: " + message.getClass());
} }

View File

@@ -52,6 +52,11 @@ public class NBOpenaireSimpleMetadataAction implements NBAction {
@Override @Override
public void applyCorrection(Context context, Item item, Item relatedItem, NBMessageDTO message) { public void applyCorrection(Context context, Item item, Item relatedItem, NBMessageDTO message) {
if (relatedItem != null) {
throw new IllegalArgumentException("NBOpenaireSimpleMetadataAction does not support related item");
}
try { try {
itemService.addMetadata(context, item, metadataSchema, metadataElement, metadataQualifier, null, itemService.addMetadata(context, item, metadataSchema, metadataElement, metadataQualifier, null,
((OpenaireMessageDTO) message).getAbstracts()); ((OpenaireMessageDTO) message).getAbstracts());

View File

@@ -33,8 +33,28 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* Implementation of {@link DSpaceRunnable} to perfom a NBEvents import from file. * Implementation of {@link DSpaceRunnable} to perfom a NBEvents import from a
* * json file. The JSON file contains an array of JSON Events, where each event
* has the following structure
*
* <code> <br/>
* { <br/>
* "originalId": "oai:www.openstarts.units.it:10077/21838",<br/>
* "title": "Egypt, crossroad of translations and literary interweavings", <br/>
* "topic": "ENRICH/MORE/PROJECT", <br/>
* "trust": 1.0, <br/>
* "message": { <br/>
* "projects[0].acronym": "PAThs", <br/>
* "projects[0].code": "687567", <br/>
* "projects[0].funder": "EC",<br/>
* "projects[0].fundingProgram": "H2020", <br/>
* "projects[0].jurisdiction": "EU",<br/>
* "projects[0].openaireId": "40|corda__h2020::6e32f5eb912688f2424c68b851483ea4", <br/>
* "projects[0].title": "Tracking Papyrus and Parchment Paths" <br/>
* } <br/>
* }
* </code>
*
* @author Alessandro Martelli (alessandro.martelli at 4science.it) * @author Alessandro Martelli (alessandro.martelli at 4science.it)
* *
*/ */
@@ -76,7 +96,7 @@ public class OpenaireEventsRunnable extends DSpaceRunnable<OpenaireEventsScriptC
configurationService = dspace.getConfigurationService(); configurationService = dspace.getConfigurationService();
topicsToImport = configurationService.getArrayProperty("oaire-nbevents.import.topic"); topicsToImport = configurationService.getArrayProperty("nbevents.openaire.import.topic");
fileLocation = commandLine.getOptionValue("f"); fileLocation = commandLine.getOptionValue("f");

View File

@@ -35,6 +35,7 @@ import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.SolrInputDocument; import org.apache.solr.common.SolrInputDocument;
import org.dspace.app.nbevent.NBSource; import org.dspace.app.nbevent.NBSource;
import org.dspace.app.nbevent.NBTopic; import org.dspace.app.nbevent.NBTopic;
import org.dspace.app.nbevent.dao.NBEventsDao;
import org.dspace.app.nbevent.dao.impl.NBEventsDaoImpl; import org.dspace.app.nbevent.dao.impl.NBEventsDaoImpl;
import org.dspace.app.nbevent.service.NBEventService; import org.dspace.app.nbevent.service.NBEventService;
import org.dspace.content.Item; import org.dspace.content.Item;
@@ -47,7 +48,10 @@ import org.dspace.services.factory.DSpaceServicesFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
/** /**
* Implementation of {@link NBEventService} that use Solr to store events. * Implementation of {@link NBEventService} that use Solr to store events. When
* the user performs an action on the event (such as accepting the suggestion or
* rejecting it) then the event is removed from solr and saved in the database
* (see {@link NBEventsDao}) so that it is no longer proposed.
* *
* @author Andrea Bollini (andrea.bollini at 4science.it) * @author Andrea Bollini (andrea.bollini at 4science.it)
* *
@@ -92,7 +96,7 @@ public class NBEventServiceImpl implements NBEventService {
protected SolrClient getSolr() { protected SolrClient getSolr() {
if (solr == null) { if (solr == null) {
String solrService = DSpaceServicesFactory.getInstance().getConfigurationService() String solrService = DSpaceServicesFactory.getInstance().getConfigurationService()
.getProperty("oaire-nbevents.solr.server", "http://localhost:8983/solr/nbevent"); .getProperty("nbevents.solr.server", "http://localhost:8983/solr/nbevent");
return new HttpSolrClient.Builder(solrService).build(); return new HttpSolrClient.Builder(solrService).build();
} }
return solr; return solr;

View File

@@ -1018,16 +1018,18 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
} }
@Override @Override
public Collection retrieveCollectionByEntityType(Context context, Item item, String entityType) public Collection retrieveCollectionWithSubmitByEntityType(Context context, Item item,
throws SQLException { String entityType) throws SQLException {
Collection ownCollection = item.getOwningCollection(); Collection ownCollection = item.getOwningCollection();
return retrieveCollectionByEntityType(context, ownCollection.getCommunities(), entityType); return retrieveWithSubmitCollectionByEntityType(context, ownCollection.getCommunities(), entityType);
} }
private Collection retrieveCollectionByEntityType(Context context, List<Community> communities, String entityType) { private Collection retrieveWithSubmitCollectionByEntityType(Context context, List<Community> communities,
String entityType) {
for (Community community : communities) { for (Community community : communities) {
Collection collection = retrieveCollectionByCommunityAndEntityType(context, community, entityType); Collection collection = retrieveCollectionWithSubmitByCommunityAndEntityType(context, community,
entityType);
if (collection != null) { if (collection != null) {
return collection; return collection;
} }
@@ -1035,17 +1037,17 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
for (Community community : communities) { for (Community community : communities) {
List<Community> parentCommunities = community.getParentCommunities(); List<Community> parentCommunities = community.getParentCommunities();
Collection collection = retrieveCollectionByEntityType(context, parentCommunities, entityType); Collection collection = retrieveWithSubmitCollectionByEntityType(context, parentCommunities, entityType);
if (collection != null) { if (collection != null) {
return collection; return collection;
} }
} }
return retrieveCollectionByCommunityAndEntityType(context, null, entityType); return retrieveCollectionWithSubmitByCommunityAndEntityType(context, null, entityType);
} }
@Override @Override
public Collection retrieveCollectionByCommunityAndEntityType(Context context, Community community, public Collection retrieveCollectionWithSubmitByCommunityAndEntityType(Context context, Community community,
String entityType) { String entityType) {
context.turnOffAuthorisationSystem(); context.turnOffAuthorisationSystem();
List<Collection> collections; List<Collection> collections;
@@ -1060,7 +1062,8 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
} }
if (community != null) { if (community != null) {
for (Community subCommunity : community.getSubcommunities()) { for (Community subCommunity : community.getSubcommunities()) {
Collection collection = retrieveCollectionByCommunityAndEntityType(context, subCommunity, entityType); Collection collection = retrieveCollectionWithSubmitByCommunityAndEntityType(context,
subCommunity, entityType);
if (collection != null) { if (collection != null) {
return collection; return collection;
} }

View File

@@ -13,9 +13,9 @@ import java.security.NoSuchAlgorithmException;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.dspace.app.nbevent.RawJsonDeserializer;
import org.dspace.app.nbevent.service.dto.NBMessageDTO; import org.dspace.app.nbevent.service.dto.NBMessageDTO;
import org.dspace.app.nbevent.service.dto.OpenaireMessageDTO; import org.dspace.app.nbevent.service.dto.OpenaireMessageDTO;
import org.dspace.util.RawJsonDeserializer;
/** /**
* This class represent the notification broker data as loaded in our solr * This class represent the notification broker data as loaded in our solr
@@ -173,7 +173,8 @@ public class NBEvent {
/* /*
* DTO constructed via Jackson use empty constructor. In this case, the eventId * DTO constructed via Jackson use empty constructor. In this case, the eventId
* must be compute on the get method * must be compute on the get method. This method create a signature based on
* the event fields and store it in the eventid attribute.
*/ */
private void computedEventId() throws NoSuchAlgorithmException, UnsupportedEncodingException { private void computedEventId() throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest digester = MessageDigest.getInstance("MD5"); MessageDigest digester = MessageDigest.getInstance("MD5");

View File

@@ -422,13 +422,14 @@ public interface CollectionService
* @return the first collection in the community or its descending * @return the first collection in the community or its descending
* that support the provided entityType * that support the provided entityType
*/ */
public Collection retrieveCollectionByCommunityAndEntityType(Context context, Community community, public Collection retrieveCollectionWithSubmitByCommunityAndEntityType(Context context, Community community,
String entityType); String entityType);
/** /**
* Retrieve the close collection to the item that support the provided * Retrieve the close collection to the item for which the current user has
* entityType. Close mean the collection that can be reach with the minimum * 'submit' privileges that support the provided entityType. Close mean the
* steps starting from the item (owningCollection, brothers collections, etc) * collection that can be reach with the minimum steps starting from the item
* (owningCollection, brothers collections, etc)
* *
* @param context the DSpace context * @param context the DSpace context
* @param item the item from where the search start * @param item the item from where the search start
@@ -436,7 +437,7 @@ public interface CollectionService
* @return the first collection in the community or its descending * @return the first collection in the community or its descending
* that support the provided entityType * that support the provided entityType
*/ */
public Collection retrieveCollectionByEntityType(Context context, Item item, String entityType) public Collection retrieveCollectionWithSubmitByEntityType(Context context, Item item, String entityType)
throws SQLException; throws SQLException;
/** /**

View File

@@ -5,7 +5,7 @@
* *
* http://www.dspace.org/license/ * http://www.dspace.org/license/
*/ */
package org.dspace.app.nbevent; package org.dspace.util;
import java.io.IOException; import java.io.IOException;

View File

@@ -0,0 +1,58 @@
/**
* 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.util;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.junit.Test;
/**
* Unit tests for {@link RawJsonDeserializer}.
*
* @author Luca Giamminonni (luca.giamminonni at 4science.it)
*
*/
public class RawJsonDeserializerTest {
private String json = ""
+ "{"
+ " \"attribute\": {"
+ " \"firstField\":\"value\","
+ " \"secondField\": 1"
+ " }"
+ "}";
@Test
public void testDeserialization() throws JsonMappingException, JsonProcessingException {
ObjectMapper mapper = new ObjectMapper();
DeserializationTestClass object = mapper.readValue(json, DeserializationTestClass.class);
assertThat(object, notNullValue());
assertThat(object.getAttribute(), is("{\"firstField\":\"value\",\"secondField\":1}"));
}
private static class DeserializationTestClass {
@JsonDeserialize(using = RawJsonDeserializer.class)
private String attribute;
public String getAttribute() {
return attribute;
}
}
}

View File

@@ -15,11 +15,11 @@ import java.util.UUID;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.dspace.app.nbevent.service.NBEventService; import org.dspace.app.nbevent.service.NBEventService;
import org.dspace.app.rest.converter.ConverterService; import org.dspace.app.rest.converter.ConverterService;
import org.dspace.app.rest.exception.UnprocessableEntityException; import org.dspace.app.rest.exception.UnprocessableEntityException;
import org.dspace.app.rest.model.ItemRest; import org.dspace.app.rest.model.ItemRest;
import org.dspace.app.rest.model.NBEventRest;
import org.dspace.app.rest.model.hateoas.ItemResource; import org.dspace.app.rest.model.hateoas.ItemResource;
import org.dspace.app.rest.utils.ContextUtil; import org.dspace.app.rest.utils.ContextUtil;
import org.dspace.app.rest.utils.Utils; import org.dspace.app.rest.utils.Utils;
@@ -47,7 +47,8 @@ import org.springframework.web.bind.annotation.RestController;
* "/api/integration/nbevents/{nbeventid}/related" * "/api/integration/nbevents/{nbeventid}/related"
*/ */
@RestController @RestController
@RequestMapping("/api/integration/nbevents" + REGEX_REQUESTMAPPING_IDENTIFIER_AS_STRING_VERSION_STRONG + "/related") @RequestMapping("/api/" + NBEventRest.CATEGORY + "/nbevents" + REGEX_REQUESTMAPPING_IDENTIFIER_AS_STRING_VERSION_STRONG
+ "/related")
public class NBEventRestController { public class NBEventRestController {
@Autowired @Autowired
protected Utils utils; protected Utils utils;
@@ -87,8 +88,6 @@ public class NBEventRestController {
if (nbevent.getRelated() != null) { if (nbevent.getRelated() != null) {
throw new UnprocessableEntityException("The nb event with ID: " + nbeventId + " already has " + throw new UnprocessableEntityException("The nb event with ID: " + nbeventId + " already has " +
"a related item"); "a related item");
} else if (!StringUtils.endsWith(nbevent.getTopic(), "/PROJECT")) {
return ControllerUtils.toEmptyResponse(HttpStatus.BAD_REQUEST);
} }
Item relatedItem = itemService.find(context, relatedItemUUID); Item relatedItem = itemService.find(context, relatedItemUUID);

View File

@@ -1631,7 +1631,7 @@ include = ${module_dir}/healthcheck.cfg
include = ${module_dir}/irus-statistics.cfg include = ${module_dir}/irus-statistics.cfg
include = ${module_dir}/oai.cfg include = ${module_dir}/oai.cfg
include = ${module_dir}/openaire-client.cfg include = ${module_dir}/openaire-client.cfg
include = ${module_dir}/oaire-nbevents.cfg include = ${module_dir}/nbevents.cfg
include = ${module_dir}/rdf.cfg include = ${module_dir}/rdf.cfg
include = ${module_dir}/rest.cfg include = ${module_dir}/rest.cfg
include = ${module_dir}/iiif.cfg include = ${module_dir}/iiif.cfg

View File

@@ -0,0 +1,21 @@
#---------------------------------------------------------------#
#-------OAIRE Notification Broker Events CONFIGURATIONS---------#
#---------------------------------------------------------------#
# Configuration properties used by data correction service #
#---------------------------------------------------------------#
nbevents.solr.server = ${solr.server}/${solr.multicorePrefix}nbevent
# A POST to these url(s) will be done to notify oaire of decision taken for each nbevents
nbevents.openaire.acknowledge-url = https://beta.api-broker.openaire.eu/feedback/events
#nbevents.openaire.acknowledge-url
# The list of the supported events incoming from openaire (see also dspace/config/spring/api/nbevents.xml)
# add missing abstract suggestion
nbevents.openaire.import.topic = ENRICH/MISSING/ABSTRACT
# add missing publication id suggestion
nbevents.openaire.import.topic = ENRICH/MISSING/PID
# add more publication id suggestion
nbevents.openaire.import.topic = ENRICH/MORE/PID
# add missing project suggestion
nbevents.openaire.import.topic = ENRICH/MISSING/PROJECT
# add more project suggestion
nbevents.openaire.import.topic = ENRICH/MORE/PROJECT

View File

@@ -1,14 +0,0 @@
#---------------------------------------------------------------#
#-------OAIRE Notification Broker Events CONFIGURATIONS---------#
#---------------------------------------------------------------#
# Configuration properties used by data correction service #
#---------------------------------------------------------------#
oaire-nbevents.solr.server = ${solr.server}/${solr.multicorePrefix}nbevent
# A POST to these url(s) will be done to notify oaire of decision taken for each nbevents
openaire-nbevents.acknowledge-url = https://beta.api-broker.openaire.eu/feedback/events
#openaire-nbevents.acknowledge-url =
oaire-nbevents.import.topic = ENRICH/MISSING/ABSTRACT
oaire-nbevents.import.topic = ENRICH/MISSING/PID
oaire-nbevents.import.topic = ENRICH/MORE/PID
oaire-nbevents.import.topic = ENRICH/MISSING/PROJECT
oaire-nbevents.import.topic = ENRICH/MORE/PROJECT

View File

@@ -18,8 +18,8 @@
<bean id="org.dspace.app.nbevent.NBEventActionService" class="org.dspace.app.nbevent.NBEventActionServiceImpl"> <bean id="org.dspace.app.nbevent.NBEventActionService" class="org.dspace.app.nbevent.NBEventActionServiceImpl">
<property name="topicsToActions"> <property name="topicsToActions">
<map> <map>
<!--The key are the TOPIC, the value must be a valid implementation of the <!--The key are the TOPIC, the value must be a valid implementation of the
org.dspace.app.nbevent.NBEventAction interface --> org.dspace.app.nbevent.NBEventAction interface -->
<entry key="ENRICH/MORE/PROJECT" value-ref="ProjectLinkedEntityAction" /> <entry key="ENRICH/MORE/PROJECT" value-ref="ProjectLinkedEntityAction" />
<entry key="ENRICH/MISSING/PROJECT" value-ref="ProjectLinkedEntityAction" /> <entry key="ENRICH/MISSING/PROJECT" value-ref="ProjectLinkedEntityAction" />
<entry key="ENRICH/MISSING/ABSTRACT" value-ref="AbstractMetadataAction" /> <entry key="ENRICH/MISSING/ABSTRACT" value-ref="AbstractMetadataAction" />
@@ -29,6 +29,8 @@
</property> </property>
</bean> </bean>
<!-- This action bind the publication to the project, otherwise if the project has not been specified,
create a new project with the available data and then bind it to the publication -->
<bean id="ProjectLinkedEntityAction" class="org.dspace.app.nbevent.NBEntityOpenaireMetadataAction"> <bean id="ProjectLinkedEntityAction" class="org.dspace.app.nbevent.NBEntityOpenaireMetadataAction">
<!-- which metadata will hold the relation between the publication and the project --> <!-- which metadata will hold the relation between the publication and the project -->
<property name="relation" value="isPublicationOfProject" /> <property name="relation" value="isPublicationOfProject" />
@@ -50,6 +52,7 @@
<bean id="AbstractMetadataAction" class="org.dspace.app.nbevent.NBOpenaireSimpleMetadataAction"> <bean id="AbstractMetadataAction" class="org.dspace.app.nbevent.NBOpenaireSimpleMetadataAction">
<property name="metadata" value="dc.description.abstract" /> <property name="metadata" value="dc.description.abstract" />
</bean> </bean>
<!-- Add a new identifier to the given item, using the defined types mapping -->
<bean id="PIDMetadataAction" class="org.dspace.app.nbevent.NBOpenaireMetadataMapAction"> <bean id="PIDMetadataAction" class="org.dspace.app.nbevent.NBOpenaireMetadataMapAction">
<property name="types"> <property name="types">
<map> <map>

View File

@@ -1,31 +0,0 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- The content of this page will be statically included into the top
of the admin page. Uncomment this as an example to see there the content
will show up.
<hr>
<i>This line will appear before the first table</i>
<tr>
<td colspan="2">
This row will be appended to the end of the first table
</td>
</tr>
<hr>
-->

View File

@@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- If this file is found in the config directory, it will only be
loaded once at startup. If it is found in Solr's data
directory, it will be re-loaded every commit.
-->
<elevate>
<query text="foo bar">
<doc id="1" />
<doc id="2" />
<doc id="3" />
</query>
<query text="ipod">
<doc id="MA147LL/A" /> <!-- put the actual ipod at the top -->
<doc id="IW-02" exclude="true" /> <!-- exclude this cable -->
</query>
</elevate>

View File

@@ -16,221 +16,55 @@
limitations under the License. limitations under the License.
--> -->
<!--
This is the Solr schema file. This file should be named "schema.xml" and
should be in the conf directory under the solr home
(i.e. ./solr/conf/schema.xml by default)
or located where the classloader for the Solr webapp can find it.
This example schema is the recommended starting point for users.
It should be kept correct and concise, usable out-of-the-box.
For more information, on how to customize this file, please see
http://wiki.apache.org/solr/SchemaXml
PERFORMANCE NOTE: this schema includes many optional features and should not
be used for benchmarking. To improve performance one could
- set stored="false" for all fields possible (esp large fields) when you
only need to search on the field but don't need to return the original
value.
- set indexed="false" if you don't need to search on the field, but only
return the field as a result of searching on other indexed fields.
- remove all unneeded copyField statements
- for best index size and searching performance, set "index" to false
for all general text fields, use copyField to copy them to the
catchall "text" field, and use that for searching.
- For maximum indexing performance, use the StreamingUpdateSolrServer
java client.
- Remember to run the JVM in server mode, and use a higher logging level
that avoids logging every request
-->
<schema name="Discovery Search DSpace 5 + CRIS" version="1.5"> <schema name="Discovery Search DSpace 5 + CRIS" version="1.5">
<!-- attribute "name" is the name of this schema and is only used for display purposes.
Applications should change this to reflect the nature of the search collection.
version="1.4" is Solr's version number for the schema syntax and semantics. It should
not normally be changed by applications.
1.0: multiValued attribute did not exist, all fields are multiValued by nature
1.1: multiValued attribute introduced, false by default
1.2: omitTermFreqAndPositions attribute introduced, true by default except for text fields.
1.3: removed optional field compress feature
1.4: default auto-phrase (QueryParser feature) to off
1.5: omitNorms defaults to true for primitive field types (int, float, boolean, string...)
-->
<types> <types>
<!-- field type definitions. The "name" attribute is
just a label to be used by field definitions. The "class"
attribute and any other attributes determine the real
behavior of the fieldType.
Class names starting with "solr" refer to java classes in the
org.apache.solr.analysis package.
-->
<!-- The StrField type is not analyzed, but indexed/stored verbatim.
- StrField and TextField support an optional compressThreshold which
limits compression (if enabled in the derived fields) to values which
exceed a certain size (in characters).
-->
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/> <fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
<!-- boolean type: "true" or "false" -->
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/> <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/>
<!--Binary data type. The data should be sent/retrieved in as Base64 encoded Strings -->
<fieldtype name="binary" class="solr.BinaryField"/> <fieldtype name="binary" class="solr.BinaryField"/>
<!-- The optional sortMissingLast and sortMissingFirst attributes are
currently supported on types that are sorted internally as strings.
This includes "string","boolean","sint","slong","sfloat","sdouble","pdate"
- If sortMissingLast="true", then a sort on this field will cause documents
without the field to come after documents with the field,
regardless of the requested sort order (asc or desc).
- If sortMissingFirst="true", then a sort on this field will cause documents
without the field to come before documents with the field,
regardless of the requested sort order.
- If sortMissingLast="false" and sortMissingFirst="false" (the default),
then default lucene sorting will be used which places docs without the
field first in an ascending sort and last in a descending sort.
-->
<!--
Default numeric field types. For faster range queries, consider the tint/tfloat/tlong/tdouble types.
-->
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/> <fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="float" class="solr.TrieFloatField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/> <fieldType name="float" class="solr.TrieFloatField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/> <fieldType name="long" class="solr.TrieLongField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/> <fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<!--
Numeric field types that index each value at various levels of precision
to accelerate range queries when the number of values between the range
endpoints is large. See the javadoc for NumericRangeQuery for internal
implementation details.
Smaller precisionStep values (specified in bits) will lead to more tokens
indexed per value, slightly larger index size, and faster range queries.
A precisionStep of 0 disables indexing at different precision levels.
-->
<fieldType name="tint" class="solr.TrieIntField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/> <fieldType name="tint" class="solr.TrieIntField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/> <fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/> <fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/> <fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
<!-- The format for this date field is of the form 1995-12-31T23:59:59Z, and
is a more restricted form of the canonical representation of dateTime
http://www.w3.org/TR/xmlschema-2/#dateTime
The trailing "Z" designates UTC time and is mandatory.
Optional fractional seconds are allowed: 1995-12-31T23:59:59.999Z
All other components are mandatory.
Expressions can also be used to denote calculations that should be
performed relative to "NOW" to determine the value, ie...
NOW/HOUR
... Round to the start of the current hour
NOW-1DAY
... Exactly 1 day prior to now
NOW/DAY+6MONTHS+3DAYS
... 6 months and 3 days in the future from the start of
the current day
Consult the DateField javadocs for more information.
Note: For faster range queries, consider the tdate type
-->
<fieldType name="date" class="solr.TrieDateField" omitNorms="true" precisionStep="0" positionIncrementGap="0"/> <fieldType name="date" class="solr.TrieDateField" omitNorms="true" precisionStep="0" positionIncrementGap="0"/>
<!-- A Trie based date field for faster date range queries and date faceting. -->
<fieldType name="tdate" class="solr.TrieDateField" omitNorms="true" precisionStep="6" positionIncrementGap="0"/> <fieldType name="tdate" class="solr.TrieDateField" omitNorms="true" precisionStep="6" positionIncrementGap="0"/>
<!--
Note:
These should only be used for compatibility with existing indexes (created with older Solr versions)
or if "sortMissingFirst" or "sortMissingLast" functionality is needed. Use Trie based fields instead.
Plain numeric field types that store and index the text
value verbatim (and hence don't support range queries, since the
lexicographic ordering isn't equal to the numeric ordering)
-->
<fieldType name="pint" class="solr.TrieIntField" omitNorms="true"/> <fieldType name="pint" class="solr.TrieIntField" omitNorms="true"/>
<fieldType name="plong" class="solr.TrieLongField" omitNorms="true"/> <fieldType name="plong" class="solr.TrieLongField" omitNorms="true"/>
<fieldType name="pfloat" class="solr.TrieFloatField" omitNorms="true"/> <fieldType name="pfloat" class="solr.TrieFloatField" omitNorms="true"/>
<fieldType name="pdouble" class="solr.TrieDoubleField" omitNorms="true"/> <fieldType name="pdouble" class="solr.TrieDoubleField" omitNorms="true"/>
<fieldType name="pdate" class="solr.TrieDateField" sortMissingLast="true" omitNorms="true"/> <fieldType name="pdate" class="solr.TrieDateField" sortMissingLast="true" omitNorms="true"/>
<!--
Note:
These should only be used for compatibility with existing indexes (created with older Solr versions)
or if "sortMissingFirst" or "sortMissingLast" functionality is needed. Use Trie based fields instead.
Numeric field types that manipulate the value into
a string value that isn't human-readable in its internal form,
but with a lexicographic ordering the same as the numeric ordering,
so that range queries work correctly.
-->
<fieldType name="sint" class="solr.TrieIntField" sortMissingLast="true" omitNorms="true"/> <fieldType name="sint" class="solr.TrieIntField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="slong" class="solr.TrieLongField" sortMissingLast="true" omitNorms="true"/> <fieldType name="slong" class="solr.TrieLongField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="sfloat" class="solr.TrieFloatField" sortMissingLast="true" omitNorms="true"/> <fieldType name="sfloat" class="solr.TrieFloatField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="sdouble" class="solr.TrieDoubleField" sortMissingLast="true" omitNorms="true"/> <fieldType name="sdouble" class="solr.TrieDoubleField" sortMissingLast="true" omitNorms="true"/>
<!-- The "RandomSortField" is not used to store or search any
data. You can declare fields of this type it in your schema
to generate pseudo-random orderings of your docs for sorting
purposes. The ordering is generated based on the field name
and the version of the index, As long as the index version
remains unchanged, and the same field name is reused,
the ordering of the docs will be consistent.
If you want different psuedo-random orderings of documents,
for the same version of the index, use a dynamicField and
change the name
-->
<fieldType name="random" class="solr.RandomSortField" indexed="true" /> <fieldType name="random" class="solr.RandomSortField" indexed="true" />
<!-- solr.TextField allows the specification of custom text analyzers
specified as a tokenizer and a list of token filters. Different
analyzers may be specified for indexing and querying.
The optional positionIncrementGap puts space between multiple fields of
this type on the same document, with the purpose of preventing false phrase
matching across fields.
For more info on customizing your analyzer chain, please see
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters
-->
<!-- One can also specify an existing Analyzer class that has a
default constructor via the class attribute on the analyzer element
<fieldType name="text_greek" class="solr.TextField">
<analyzer class="org.apache.lucene.analysis.el.GreekAnalyzer"/>
</fieldType>
-->
<!-- A text field that only splits on whitespace for exact matching of words -->
<fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100"> <fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100">
<analyzer> <analyzer>
<tokenizer class="solr.WhitespaceTokenizerFactory"/> <tokenizer class="solr.WhitespaceTokenizerFactory"/>
</analyzer> </analyzer>
</fieldType> </fieldType>
<!-- A text field that uses WordDelimiterFilter to enable splitting and matching of
words on case-change, alpha numeric boundaries, and non-alphanumeric chars,
so that a query of "wifi" or "wi fi" could match a document containing "Wi-Fi".
Synonyms and stopwords are customized by external files, and stemming is enabled.
Duplicate tokens at the same position (which may result from Stemmed Synonyms or
WordDelim parts) are removed.
-->
<fieldType name="text" class="solr.TextField" positionIncrementGap="100"> <fieldType name="text" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index"> <analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/> <tokenizer class="solr.WhitespaceTokenizerFactory"/>
<!-- in this example, we will only use synonyms at query time
<filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
-->
<!-- Case insensitive stop word removal.
add [enablePositionIncrements=true depracated v.5] in both the index and query
analyzers to leave a 'gap' for more accurate phrase queries.
-->
<filter class="solr.StopFilterFactory" <filter class="solr.StopFilterFactory"
ignoreCase="true" ignoreCase="true"
words="stopwords.txt" words="stopwords.txt"
@@ -253,9 +87,7 @@
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/> <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer> </analyzer>
</fieldType> </fieldType>
<!-- Less flexible matching, but less false matches. Probably not ideal for product names,
but may be good for SKUs. Can insert dashes in the wrong place and still match. -->
<fieldType name="textTight" class="solr.TextField" positionIncrementGap="100" > <fieldType name="textTight" class="solr.TextField" positionIncrementGap="100" >
<analyzer> <analyzer>
<tokenizer class="solr.WhitespaceTokenizerFactory"/> <tokenizer class="solr.WhitespaceTokenizerFactory"/>
@@ -270,9 +102,6 @@
</analyzer> </analyzer>
</fieldType> </fieldType>
<!-- A general unstemmed text field - good if one does not know the language of the field -->
<fieldType name="textgen" class="solr.TextField" positionIncrementGap="100"> <fieldType name="textgen" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index"> <analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/> <tokenizer class="solr.WhitespaceTokenizerFactory"/>
@@ -292,10 +121,6 @@
</analyzer> </analyzer>
</fieldType> </fieldType>
<!-- A general unstemmed text field that indexes tokens normally and also
reversed (via ReversedWildcardFilterFactory), to enable more efficient
leading wildcard queries. -->
<fieldType name="text_rev" class="solr.TextField" positionIncrementGap="100"> <fieldType name="text_rev" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index"> <analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/> <tokenizer class="solr.WhitespaceTokenizerFactory"/>
@@ -316,44 +141,14 @@
<filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.LowerCaseFilterFactory"/>
</analyzer> </analyzer>
</fieldType> </fieldType>
<!-- charFilter + WhitespaceTokenizer -->
<!--
<fieldType name="textCharNorm" class="solr.TextField" positionIncrementGap="100" >
<analyzer>
<charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/>
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
</analyzer>
</fieldType>
-->
<!-- This is an example of using the KeywordTokenizer along
With various TokenFilterFactories to produce a sortable field
that does not include some properties of the source text
-->
<fieldType name="alphaOnlySort" class="solr.TextField" sortMissingLast="true" omitNorms="true"> <fieldType name="alphaOnlySort" class="solr.TextField" sortMissingLast="true" omitNorms="true">
<analyzer> <analyzer>
<!-- KeywordTokenizer does no actual tokenizing, so the entire
input string is preserved as a single token
-->
<tokenizer class="solr.KeywordTokenizerFactory"/> <tokenizer class="solr.KeywordTokenizerFactory"/>
<!-- The LowerCase TokenFilter does what you expect, which can be
when you want your sorting to be case insensitive
-->
<filter class="solr.LowerCaseFilterFactory" /> <filter class="solr.LowerCaseFilterFactory" />
<!-- The TrimFilter removes any leading or trailing whitespace -->
<filter class="solr.TrimFilterFactory" /> <filter class="solr.TrimFilterFactory" />
<!-- The PatternReplaceFilter gives you the flexibility to use
Java Regular expression to replace any sequence of characters
matching a pattern with an arbitrary replacement string,
which may include back references to portions of the original
string matched by the pattern.
See the Java Regular Expression documentation for more
information on pattern and replacement string syntax.
http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/package-summary.html
-->
<filter class="solr.PatternReplaceFilterFactory" <filter class="solr.PatternReplaceFilterFactory"
pattern="([^a-z])" replacement="" replace="all" pattern="([^a-z])" replacement="" replace="all"
/> />
@@ -370,22 +165,10 @@
<fieldtype name="payloads" stored="false" indexed="true" class="solr.TextField" > <fieldtype name="payloads" stored="false" indexed="true" class="solr.TextField" >
<analyzer> <analyzer>
<tokenizer class="solr.WhitespaceTokenizerFactory"/> <tokenizer class="solr.WhitespaceTokenizerFactory"/>
<!--
The DelimitedPayloadTokenFilter can put payloads on tokens... for example,
a token of "foo|1.4" would be indexed as "foo" with a payload of 1.4f
Attributes of the DelimitedPayloadTokenFilterFactory :
"delimiter" - a one character delimiter. Default is | (pipe)
"encoder" - how to encode the following value into a playload
float -> org.apache.lucene.analysis.payloads.FloatEncoder,
integer -> o.a.l.a.p.IntegerEncoder
identity -> o.a.l.a.p.IdentityEncoder
Fully Qualified class name implementing PayloadEncoder, Encoder must have a no arg constructor.
-->
<filter class="solr.DelimitedPayloadTokenFilterFactory" encoder="float"/> <filter class="solr.DelimitedPayloadTokenFilterFactory" encoder="float"/>
</analyzer> </analyzer>
</fieldtype> </fieldtype>
<!-- lowercases the entire field value, keeping it as a single token. -->
<fieldType name="lowercase" class="solr.TextField" positionIncrementGap="100"> <fieldType name="lowercase" class="solr.TextField" positionIncrementGap="100">
<analyzer> <analyzer>
<tokenizer class="solr.KeywordTokenizerFactory"/> <tokenizer class="solr.KeywordTokenizerFactory"/>
@@ -393,16 +176,8 @@
</analyzer> </analyzer>
</fieldType> </fieldType>
<!-- since fields of this type are by default not stored or indexed,
any data added to them will be ignored outright. -->
<fieldtype name="ignored" stored="false" indexed="false" multiValued="true" class="solr.StrField" /> <fieldtype name="ignored" stored="false" indexed="false" multiValued="true" class="solr.StrField" />
<!-- This is an example of using the KeywordTokenizer along
With various TokenFilterFactories to produce a sortable field
that does not include some properties of the source text
-->
<fieldType name="lowerCaseSort" class="solr.TextField" sortMissingLast="true" omitNorms="true"> <fieldType name="lowerCaseSort" class="solr.TextField" sortMissingLast="true" omitNorms="true">
<analyzer> <analyzer>
<!-- KeywordTokenizer does no actual tokenizing, so the entire <!-- KeywordTokenizer does no actual tokenizing, so the entire
@@ -418,8 +193,6 @@
</analyzer> </analyzer>
</fieldType> </fieldType>
<!-- This field is used for store metadatavalue (with authority, prefered label, variants and
language) to use in projection -->
<fieldType name="dspaceMetadataProjection" class="solr.TextField" sortMissingLast="true" omitNorms="true"> <fieldType name="dspaceMetadataProjection" class="solr.TextField" sortMissingLast="true" omitNorms="true">
<analyzer> <analyzer>
<!--Treats the entire field as a single token, regardless of its content--> <!--Treats the entire field as a single token, regardless of its content-->
@@ -427,7 +200,6 @@
</analyzer> </analyzer>
</fieldType> </fieldType>
<!--This field is used for auto complete features in the discovery search-->
<fieldType name="dspaceAutoComplete" class="solr.TextField" sortMissingLast="true" omitNorms="true"> <fieldType name="dspaceAutoComplete" class="solr.TextField" sortMissingLast="true" omitNorms="true">
<analyzer> <analyzer>
<tokenizer class="solr.KeywordTokenizerFactory"/> <tokenizer class="solr.KeywordTokenizerFactory"/>
@@ -451,10 +223,6 @@
</analyzer> </analyzer>
</fieldType> </fieldType>
<!--
SpellCheck analysis config based off of http://wiki.apache.org/solr/
SpellCheckingAnalysis
-->
<fieldType name="textSpell" class="solr.TextField" <fieldType name="textSpell" class="solr.TextField"
positionIncrementGap="100" stored="false" multiValued="true"> positionIncrementGap="100" stored="false" multiValued="true">
<analyzer type="index"> <analyzer type="index">
@@ -483,32 +251,7 @@
<fields> <fields>
<field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/> <field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>
<!-- Valid attributes for fields:
name: mandatory - the name for the field
type: mandatory - the name of a previously defined type from the
<types> section
indexed: true if this field should be indexed (searchable or sortable)
stored: true if this field should be retrievable
compressed: [false] if this field should be stored using gzip compression
(this will only apply if the field type is compressable; among
the standard field types, only TextField and StrField are)
multiValued: true if this field may contain multiple values per document
omitNorms: (expert) set to true to omit the norms associated with
this field (this disables length normalization and index-time
boosting for the field, and saves some memory). Only full-text
fields or fields that need an index-time boost need norms.
termVectors: [false] set to true to store the term vector for a
given field.
When using MoreLikeThis, fields used for similarity should be
stored for best performance.
termPositions: Store position information with the term vector.
This will increase storage costs.
termOffsets: Store offset information with the term vector. This
will increase storage costs.
default: a value that should be used if no value is specified
when adding a document.
-->
<field name="source" type="string" indexed="true" stored="true" omitNorms="true" /> <field name="source" type="string" indexed="true" stored="true" omitNorms="true" />
<field name="event_id" type="string" indexed="true" stored="true" omitNorms="true" /> <field name="event_id" type="string" indexed="true" stored="true" omitNorms="true" />
<field name="original_id" type="string" indexed="true" stored="true" omitNorms="true" /> <field name="original_id" type="string" indexed="true" stored="true" omitNorms="true" />
@@ -532,14 +275,6 @@
</fields> </fields>
<!-- Field to use to determine and enforce document uniqueness.
Unless this field is marked with required="false", it will be a required field
-->
<uniqueKey>event_id</uniqueKey> <uniqueKey>event_id</uniqueKey>
<!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
<!-- [deprecated?]
<solrQueryParser defaultOperator="AND"/>
-->
</schema> </schema>

View File

@@ -1,24 +0,0 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
user=
solr_hostname=localhost
solr_port=8983
rsyncd_port=18983
data_dir=
webapp_name=solr
master_host=
master_data_dir=
master_status_dir=

File diff suppressed because it is too large Load Diff

View File

@@ -1,2 +0,0 @@
pizza
history