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

EA-3278 remove debug param and add profile #130

Merged
merged 6 commits into from
Mar 19, 2024
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
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<properties>
<spring.boot.mainclass>eu.europeana.fulltext.api.FtApplication</spring.boot.mainclass>
<solr-solrj.version>8.11.1</solr-solrj.version>
<solr-solrj.version>8.11.3</solr-solrj.version>
<javax-validation.version>2.0.1.Final</javax-validation.version>
<apache-commons-text.version>1.10.0</apache-commons-text.version>
<spring-boot-starter-data-solr.version>2.4.13</spring-boot-starter-data-solr.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public class FTSettings implements InitializingBean {
@Value("${resource.baseurl}")
private String resourceBaseUrl;

@Value("${search.baseurl}")
private String searchBaseUrl;

@Value("${search.textGranularity.default:Word}")
private String searchTextGranularity;
private List<AnnotationType> defaultSearchTextGranularity;
Expand Down Expand Up @@ -175,6 +178,10 @@ public String getResourceBaseUrl() {
return resourceBaseUrl;
}

public String getSearchBaseUrl() {
return searchBaseUrl;
}

public List<AnnotationType> getDefaultSearchTextGranularity() {
return Collections.unmodifiableList(defaultSearchTextGranularity);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package eu.europeana.fulltext.api.model.v2;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.io.Serializable;

/**
* Created by luthien on 14/06/2018.
*/
@JsonPropertyOrder({"id", "type", "edmRights", "source", "language", "value"})
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AnnotationBodyV2 extends JsonLdId implements Serializable{

private static final long serialVersionUID = -814446825873060414L;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package eu.europeana.fulltext.api.model.v2;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonIgnore;
Expand All @@ -14,6 +15,7 @@
*/
//@JsonldType(value = "oa:Annotation") // commenting this out works for property ordering #EA-1310
@JsonPropertyOrder({"context", "id", "type", "motivation", "textGranularity", "resource", "on"})
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AnnotationV2 extends JsonLdId implements Serializable, AnnotationWrapper {

private static final long serialVersionUID = 7120324589144279826L;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package eu.europeana.fulltext.api.model.v3;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import eu.europeana.fulltext.api.model.JsonLdIdType;

Expand All @@ -9,6 +10,7 @@
* Created by luthien on 14/06/2018.
*/
@JsonPropertyOrder({"id", "type", "edmRights", "source", "language", "value"})
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AnnotationBodyV3 extends JsonLdIdType implements Serializable{

private static final long serialVersionUID = 481686784002335472L;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package eu.europeana.fulltext.api.model.v3;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import eu.europeana.fulltext.AnnotationType;
Expand All @@ -16,6 +17,7 @@
* Created by luthien target 14/06/2018.
*/
@JsonPropertyOrder({"context", "id", "type", "motivation", "textGranularity", "body", "target"})
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AnnotationV3 extends JsonLdIdType implements Serializable, AnnotationWrapper {

private static final long serialVersionUID = 8849251970656404497L;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package eu.europeana.fulltext.search.model.response.v2;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import eu.europeana.fulltext.api.model.v2.AnnotationV2;
Expand All @@ -15,6 +16,7 @@
import java.util.List;

@JsonPropertyOrder({"id", "type", "debug", "resources", "hits"})
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SearchResultV2 implements Serializable, SearchResult {

private static final long serialVersionUID = 5755904077393708504L;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package eu.europeana.fulltext.search.model.response.v3;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import eu.europeana.fulltext.api.model.v3.AnnotationV3;
import eu.europeana.fulltext.api.service.EDM2IIIFMapping;
Expand All @@ -14,6 +15,7 @@
import java.util.List;

@JsonPropertyOrder({"id", "type", "debug", "items", "hits"})
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SearchResultV3 implements Serializable, SearchResult {

private static final long serialVersionUID = -5643549600050178321L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.List;
import java.util.Set;

import static eu.europeana.fulltext.util.RequestUtils.*;
import static eu.europeana.iiif.AcceptUtils.*;

/**
Expand Down Expand Up @@ -62,7 +63,7 @@ public FTSearchController(FTSearchService searchService, FTSettings settings) {
* @param q alternative search query (will override query if specified both
* @param pageSize maximum number of hits
* @param textGranularity one-letter abbreviation or name of an Annotation type
* @param debug if specified then include debug information in the response
* @param profile if profile debug is requested then include debug information in the response
* @throws EuropeanaApiException when there is an error processing the request
*/
@GetMapping(value = "/{datasetId}/{localId}/search", headers = ACCEPT_JSON)
Expand All @@ -72,9 +73,9 @@ public ResponseEntity searchIssueJson(@PathVariable String datasetId, @PathVaria
@RequestParam(required = false, defaultValue = "12") int pageSize,
@RequestParam(required = false) String textGranularity,
@RequestParam(value = "format", required = false) String versionParam,
@RequestParam(required = false) String debug,
@RequestParam(value = "profile", required = false) String profile,
HttpServletRequest request) throws EuropeanaApiException {
return searchIssue(datasetId, localId, query, q, pageSize, textGranularity, versionParam, debug, request, true);
return searchIssue(datasetId, localId, query, q, pageSize, textGranularity, versionParam, profile, request, true);
}

/**
Expand All @@ -86,7 +87,7 @@ public ResponseEntity searchIssueJson(@PathVariable String datasetId, @PathVaria
* @param q alternative search query (will override query if specified both
* @param pageSize maximum number of hits
* @param textGranularity one-letter abbreviation or name of an Annotation type
* @param debug if specified then include debug information in the response
* @param profile if profile debug is requested then include debug information in the response
* @throws EuropeanaApiException when there is an error processing the request
*/
@GetMapping(value = "/{dsId}/{lcId}/search", headers = ACCEPT_JSONLD)
Expand All @@ -96,13 +97,13 @@ public ResponseEntity searchIssueJsonLd(@PathVariable String dsId, @PathVariable
@RequestParam(required = false, defaultValue = "12") int pageSize,
@RequestParam(required = false) String textGranularity,
@RequestParam(value = "format", required = false) String versionParam,
@RequestParam(required = false) String debug,
@RequestParam(value = "profile", required = false) String profile,
HttpServletRequest request) throws EuropeanaApiException {
return searchIssue(dsId, lcId, query, q, pageSize, textGranularity, versionParam, debug, request, false);
return searchIssue(dsId, lcId, query, q, pageSize, textGranularity, versionParam, profile, request, false);
}

private ResponseEntity searchIssue(String datasetId, String localId, String query, String q, int pageSize, String textGranularity,
String versionParam, String debug, HttpServletRequest request, boolean isJson) throws EuropeanaApiException {
String versionParam, String profile, HttpServletRequest request, boolean isJson) throws EuropeanaApiException {
// validate the format
if (!settings.isSolrEnabled()){
throw new SearchDisabledException();
Expand All @@ -120,10 +121,12 @@ private ResponseEntity searchIssue(String datasetId, String localId, String quer
}
List<AnnotationType> annoTypes = validateTextGranularity(textGranularity);

List<String> profiles = extractProfiles(profile);

// start processing
String searchId = request.getRequestURI() + "?" + request.getQueryString();
String searchId = settings.getSearchBaseUrl() + request.getRequestURI() + "?" + request.getQueryString();
SearchResult searchResult = searchService.searchIssue(searchId, new EuropeanaId(datasetId, localId), qry,
pageSize, annoTypes, requestVersion, (debug != null));
pageSize, annoTypes, requestVersion, profiles.contains(PROFILE_DEBUG));

HttpHeaders headers = new HttpHeaders();
AcceptUtils.addContentTypeToResponseHeader(headers, requestVersion, isJson);
Expand Down
2 changes: 2 additions & 0 deletions api/src/main/resources/fulltext.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ annotation.baseurl=http://data.europeana.eu/annotation/
#EA-3635
resource.baseurl=https://api.europeana.eu/fulltext/

#EA-3728 (without trailing '/' at the end )
search.baseurl=https://iiif.europeana.eu

# connectionUrl for mongo server
mongo.connectionUrl=
Expand Down
2 changes: 1 addition & 1 deletion indexing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<artifactId>indexing</artifactId>
<properties>
<spring.boot.mainclass>eu.europeana.fulltext.indexing.IndexingApplication</spring.boot.mainclass>
<solr-solrj.version>7.7.2</solr-solrj.version>
<solr-solrj.version>8.11.3</solr-solrj.version>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.0</version>
<version>${snakeyaml.version}</version>
</dependency>


Expand Down
1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
<build-helper-maven.version>3.0.0</build-helper-maven.version>
<maven-failsafe.version>3.0.0-M5</maven-failsafe.version>
<dependency-check-maven.version>7.3.0</dependency-check-maven.version>

<jettison.version>1.5.4</jettison.version>
<snakeyaml.version>2.0</snakeyaml.version>

Expand Down
Loading