partial implementation

This commit is contained in:
Michele Artini 2024-11-22 14:18:21 +01:00
parent febfc63cd7
commit 9b762600b2
5 changed files with 37 additions and 94 deletions

103
pom.xml
View File

@ -280,100 +280,61 @@
<outputDirectory>target/classes</outputDirectory>
<finalName>${project.artifactId}-${project.version}</finalName>
<testOutputDirectory>target/test-classes</testOutputDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M4</version>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<detectLinks>true</detectLinks>
<doclint>none</doclint>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.21.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>effective-pom</goal>
</goals>
<configuration>
<output>${project.build.outputDirectory}/META-INF/maven/${project.groupId}/${project.artifactId}/effective-pom.xml</output>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>2.10</version>
<version>3.5.3</version>
</extension>
</extensions>
</build>
<distributionManagement>
<snapshotRepository>
<id>dnet45-snapshots</id>

View File

@ -275,7 +275,6 @@ public class SolrRecordMapper {
instance.setUrl(Arrays.asList(re.getUrl()));
}
// TODO: valutare il colore OpenAccess: green, bronze, hybrid
if (StringUtils.isNotBlank(re.getAccessRightCode())) {
final String code = re.getAccessRightCode();
final String label = vocClient.findTermLabel("dnet:access_modes", re.getAccessRightCode());
@ -384,10 +383,7 @@ public class SolrRecordMapper {
final List<Concept> res = new ArrayList<Concept>();
filterContextInfoByLevel(nodes, level, parent).forEach((k, v) -> {
final Concept cpt = Concept.newInstance(k, v.getLabel());
// TODO The class is limited at only 1 level for the concepts
// cpt.setConcept(prepareDnetConcepts(nodes, k, level + 1));
res.add(cpt);
res.add(Concept.newInstance(k, v.getLabel()));
});
return res;

View File

@ -3,7 +3,6 @@ package eu.dnetlib.app.directindex.solr;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.stream.Stream;
@ -33,14 +32,6 @@ public class SolrIndexClient {
this.cloudSolrClient = cloudSolrClient;
}
public void commit() throws DirectIndexApiException {
try {
cloudSolrClient.commit();
} catch (SolrServerException | IOException e) {
throw new DirectIndexApiException(e);
}
}
public void deleteByQuery(final String query) throws DirectIndexApiException {
try {
cloudSolrClient.deleteByQuery(query);
@ -52,11 +43,8 @@ public class SolrIndexClient {
public void addRecords(final Stream<SolrRecord> records) throws DirectIndexApiException {
try {
final Iterator<SolrInputDocument> iter = records
.map(this::prepareSolrDocument)
.iterator();
cloudSolrClient.add(iter);
cloudSolrClient.add(records.map(this::prepareSolrDocument).iterator());
cloudSolrClient.commit();
} catch (final Throwable e) {
throw new DirectIndexApiException("Error creating solr document", e);
}
@ -66,7 +54,7 @@ public class SolrIndexClient {
addRecords(Arrays.stream(records));
}
protected SolrInputDocument prepareSolrDocument(final SolrRecord record) {
private SolrInputDocument prepareSolrDocument(final SolrRecord record) {
// TODO (usare classe condivisa preparata da Claudio)
return null;

View File

@ -68,8 +68,6 @@ public class ScheduledActions {
.map(solrRecordMapper::toSolrRecord)
.filter(Objects::nonNull));
solr.commit();
updateExecutionDate(list);
}

View File

@ -17,7 +17,7 @@ dnet.directindex.vocabulary.url = https://services.openaire.eu/provision/mvc/voc
spring.profiles.active=dev
maven.pom.path = /META-INF/maven/eu.dnetlib.dhp/dnet-directindex-api/effective-pom.xml
maven.pom.path = /META-INF/maven/eu.dnetlib.dhp/dnet-directindex-application/effective-pom.xml
spring.main.banner-mode = off