Skip to content

Commit

Permalink
new search params added to literature-ws(gbif/gbif-api#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahakanzn committed Aug 13, 2024
1 parent 8037226 commit a64fa67
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<swagger-annotations.version>2.2.0</swagger-annotations.version>
<super-csv.version>2.4.0</super-csv.version>

<gbif-api.version>1.16.1</gbif-api.version>
<gbif-api.version>1.16.4-SNAPSHOT</gbif-api.version>
<gbif-common-ws.version>1.27</gbif-common-ws.version>

<spring-cloud-openfeign.version>2.2.6.RELEASE</spring-cloud-openfeign.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
*/
package org.gbif.literature.resource;

import java.util.Date;

import org.gbif.api.documentation.CommonParameters;
import org.gbif.api.model.common.export.ExportFormat;
import org.gbif.api.model.common.paging.Pageable;
Expand Down Expand Up @@ -259,7 +261,35 @@ public LiteratureResource(LiteratureSearchService searchService) {
+ REPEATED,
schema = @Schema(implementation = Language.class),
in = ParameterIn.QUERY,
explode = Explode.TRUE)
explode = Explode.TRUE),
@Parameter(
name = "added",
description =
"Date or date range when the publication was added. Format is ISO 8601, e.g., '2024-07-14' or '2024-07-14,2024-08-14'.",
schema = @Schema(implementation = Date.class),
in = ParameterIn.QUERY,
explode = Explode.TRUE),
@Parameter(
name = "published",
description =
"Date or date range when the publication was published. Format is ISO 8601, e.g., '2024-02-22' or '2024-02-22,2024-03-22'.",
schema = @Schema(implementation = Date.class),
in = ParameterIn.QUERY,
explode = Explode.TRUE),
@Parameter(
name = "discovered",
description =
"Date or date range when the publication was discovered. Format is ISO 8601, e.g., '2024-02-26' or '2024-02-26,2024-03-26'.",
schema = @Schema(implementation = Date.class),
in = ParameterIn.QUERY,
explode = Explode.TRUE),
@Parameter(
name = "modified",
description =
"Date or date range when the publication was discovered. Format is ISO 8601, e.g., '2024-07-26' or '2024-07-26,2024-10-26'.",
schema = @Schema(implementation = Date.class),
in = ParameterIn.QUERY,
explode = Explode.TRUE)
})
@CommonParameters.QParameter
@interface CommonSearchParameters {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ public class LiteratureEsFieldMapper implements EsFieldMapper<LiteratureSearchPa
.put(LiteratureSearchParameter.GBIF_PROJECT_IDENTIFIER, "gbifProjectIdentifier")
.put(LiteratureSearchParameter.GBIF_PROGRAMME, "gbifProgrammeAcronym")
.put(LiteratureSearchParameter.LANGUAGE, "language")
.put(LiteratureSearchParameter.ADDED, "created")
.put(LiteratureSearchParameter.PUBLISHED, "createdAt")
.put(LiteratureSearchParameter.DISCOVERED, "accessed")
.put(LiteratureSearchParameter.MODIFIED, "updatedAt")
.build();

public static final Map<String, Integer> CARDINALITIES =
Expand All @@ -79,7 +83,7 @@ public class LiteratureEsFieldMapper implements EsFieldMapper<LiteratureSearchPa
private static final String[] EXCLUDE_FIELDS = new String[] {"all"};

public static final List<String> DATE_FIELDS =
ImmutableList.of("created", "createdAt", "updatedAt");
ImmutableList.of("created", "createdAt", "updatedAt", "accessed");

@Override
public String get(LiteratureSearchParameter searchParameter) {
Expand Down

0 comments on commit a64fa67

Please sign in to comment.