diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/DatabaseDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/DatabaseDto.java index e1b4298cc30d959b7d6c2e23dfe287b3cbe8382d..e6db0c9736efc00906c9ea3a8cedf36bd669f164 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/DatabaseDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/DatabaseDto.java @@ -62,10 +62,10 @@ public class DatabaseDto { @Field(name = "description", type = FieldType.Text) private String description; - @Field(name = "tables", type = FieldType.Nested) + @Field(name = "tables", type = FieldType.Object) private List<TableDto> tables; - @Field(name = "views", type = FieldType.Nested) + @Field(name = "views", type = FieldType.Object) private List<ViewDto> views; @JsonProperty("is_public") @@ -73,26 +73,28 @@ public class DatabaseDto { @Field(name = "is_public", type = FieldType.Boolean) private Boolean isPublic; - @Field(name = "container", type = FieldType.Nested) + @Field(name = "container", type = FieldType.Object) private ContainerDto container; + @org.springframework.data.annotation.Transient private List<DatabaseAccessDto> accesses; - @Field(name = "identifiers", type = FieldType.Nested) + @Field(name = "identifiers", type = FieldType.Object) private List<IdentifierDto> identifiers; - @Field(name = "subsets", type = FieldType.Nested) + @Field(name = "subsets", type = FieldType.Object) private List<IdentifierDto> subsets; @NotNull + @org.springframework.data.annotation.Transient private UserDto creator; @NotNull - @Field(name = "contact", type = FieldType.Nested) + @Field(name = "contact", type = FieldType.Object) private UserDto contact; @NotNull - @Field(name = "owner", type = FieldType.Nested) + @Field(name = "owner", type = FieldType.Object) private UserDto owner; @NotNull diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/LicenseDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/LicenseDto.java index e8f7109acb8adc3241fb893db48e0131bd612d57..0f548b71ba050aeefde1f909296e395a56289870 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/LicenseDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/LicenseDto.java @@ -6,6 +6,8 @@ import lombok.*; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.extern.jackson.Jacksonized; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; @Getter @Setter @@ -18,10 +20,12 @@ public class LicenseDto { @NotNull @Schema(example = "MIT") + @Field(name = "identifier", type = FieldType.Keyword) private String identifier; @NotBlank @Schema(example = "https://opensource.org/licenses/MIT") + @Field(name = "uri", type = FieldType.Keyword) private String uri; } \ No newline at end of file diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/ViewDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/ViewDto.java index 84df87e0170a537128f307d6b0c5479de0dd6630..9eef10f09ccebebfdac0a9c112950573d6d1c891 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/ViewDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/ViewDto.java @@ -49,7 +49,7 @@ public class ViewDto { @Field(name = "name", type = FieldType.Keyword) private String name; - @Field(name = "identifiers", type = FieldType.Nested) + @Field(name = "identifiers", type = FieldType.Object) private List<IdentifierDto> identifiers; @NotBlank @@ -90,6 +90,7 @@ public class ViewDto { private UUID createdBy; @NotNull + @org.springframework.data.annotation.Transient private UserDto creator; @NotNull(message = "columns are required") diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TableDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TableDto.java index b05b843ae5c6f975b0ef9d00befcf5b4a4e50747..3e1f8788680c93c8c778eedb9e56d64e574ba8b7 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TableDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TableDto.java @@ -49,7 +49,7 @@ public class TableDto { @Field(name = "internal_name", type = FieldType.Keyword) private String internalName; - @Field(name = "identifiers", type = FieldType.Nested) + @Field(name = "identifiers", type = FieldType.Object) private List<IdentifierDto> identifiers; @NotNull @@ -64,11 +64,11 @@ public class TableDto { private UUID createdBy; @NotNull(message = "creator is required") - @Field(name = "creator", type = FieldType.Nested) + @org.springframework.data.annotation.Transient private UserDto creator; @NotNull(message = "owner is required") - @Field(name = "owner", type = FieldType.Nested) + @Field(name = "owner", type = FieldType.Object) private UserDto owner; @NotBlank(message = "queueName is required") @@ -107,7 +107,7 @@ public class TableDto { @NotNull(message = "columns are required") private List<ColumnDto> columns; - @Field(name = "constraints", type = FieldType.Nested) + @Field(name = "constraints", type = FieldType.Object) private ConstraintsDto constraints; } diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/columns/ColumnDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/columns/ColumnDto.java index fc667ae8ee479d20dfb7289b061d8917cab63c8a..7d5311c5f6579ba342faa3533952607868f5a310 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/columns/ColumnDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/columns/ColumnDto.java @@ -57,7 +57,7 @@ public class ColumnDto { private String alias; @JsonProperty("date_format") - @Field(name = "date_format", type = FieldType.Nested) + @Field(name = "date_format", type = FieldType.Object) private ImageDateDto dateFormat; @NotNull @@ -126,10 +126,10 @@ public class ColumnDto { @Field(name = "std_dev", type = FieldType.Double) private BigDecimal stdDev; - @Field(name = "concept", type = FieldType.Nested) + @Field(name = "concept", type = FieldType.Object) private ConceptDto concept; - @Field(name = "unit", type = FieldType.Nested) + @Field(name = "unit", type = FieldType.Object) private UnitDto unit; @NotNull @@ -144,11 +144,11 @@ public class ColumnDto { @Schema(example = "false") private Boolean isNullAllowed; - @Field(name = "enums", type = FieldType.Nested) + @Field(name = "enums", type = FieldType.Object) @Parameter(description = "enum values, only considered when type = ENUM") private List<String> enums; - @Field(name = "sets", type = FieldType.Nested) + @Field(name = "sets", type = FieldType.Object) @Parameter(description = "enum values, only considered when type = ENUM") private List<String> sets; diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/ConstraintsDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/ConstraintsDto.java index 6c5b703634cce81fbbe0c2add8d8231792b4da29..ae3b4d8c4e960ae3ed358a44f7807788908c84b4 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/ConstraintsDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/ConstraintsDto.java @@ -19,12 +19,13 @@ import java.util.List; @ToString public class ConstraintsDto { - @Field(name = "uniques", type = FieldType.Nested) + @Field(name = "uniques", type = FieldType.Object) private List<UniqueDto> uniques; @JsonProperty("foreign_keys") - @Field(name = "foreign_keys", type = FieldType.Nested) + @Field(name = "foreign_keys", type = FieldType.Object) private List<ForeignKeyDto> foreignKeys; + @Field(name = "checks", type = FieldType.Object) private List<String> checks; } diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierDto.java index aee2e3281efdfe881a917e7ec0b002fcb3b6b3fd..a405eece1b6a4b601c4d73e27e6a0f01e117d9de 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierDto.java @@ -58,13 +58,13 @@ public class IdentifierDto { @Field(name = "type", type = FieldType.Keyword) private IdentifierTypeDto type; - @Field(name = "titles", type = FieldType.Nested) + @Field(name = "titles", type = FieldType.Object) private List<IdentifierTitleDto> titles; - @Field(name = "descriptions", type = FieldType.Nested) + @Field(name = "descriptions", type = FieldType.Object) private List<IdentifierDescriptionDto> descriptions; - @Field(name = "funders", type = FieldType.Nested) + @Field(name = "funders", type = FieldType.Object) private List<IdentifierFunderDto> funders; @NotBlank @@ -79,7 +79,7 @@ public class IdentifierDto { private String queryNormalized; @JsonProperty("related_identifiers") - @Field(name = "related_identifiers", type = FieldType.Nested) + @Field(name = "related_identifiers", type = FieldType.Object) private List<RelatedIdentifierDto> relatedIdentifiers; @NotBlank @@ -116,7 +116,7 @@ public class IdentifierDto { @NotNull @JsonIgnore - @Field(name = "creator", type = FieldType.Nested) + @org.springframework.data.annotation.Transient private UserDto creator; @JsonProperty("publication_day") @@ -138,11 +138,11 @@ public class IdentifierDto { @Field(name = "language", type = FieldType.Keyword) private LanguageTypeDto language; - @Field(name = "licenses", type = FieldType.Nested) + @Field(name = "licenses", type = FieldType.Object) private List<LicenseDto> licenses; @NotNull - @Field(name = "creators", type = FieldType.Nested) + @Field(name = "creators", type = FieldType.Object) private List<CreatorDto> creators; @NotNull diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/user/UserDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/user/UserDto.java index 069efaf3ff683f3a169b8f2365f770034a538597..e35da63f653dbc900ba014d8295b446be304545a 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/user/UserDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/user/UserDto.java @@ -55,6 +55,7 @@ public class UserDto { private String lastname; @NotNull + @org.springframework.data.annotation.Transient private UserAttributesDto attributes; } diff --git a/dbrepo-search-db/init/indices/database.json b/dbrepo-search-db/init/indices/database.json index 5af0540921eec23181c3af7beec4015233d4e3a5..087176e1a0c6db25ba8c0eca8443ce40ab9d10ab 100644 --- a/dbrepo-search-db/init/indices/database.json +++ b/dbrepo-search-db/init/indices/database.json @@ -1,1148 +1,1189 @@ { "aliases": {}, "mappings": { - "properties": { - "accesses": { - "properties": { - "created": { - "type": "long" - }, - "hdbid": { - "type": "long" - }, - "huserid": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "properties": { + "contact": { + "type": "object", + "properties": { + "firstname": { + "type": "keyword" + }, + "id": { + "type": "keyword" + }, + "lastname": { + "type": "keyword" + }, + "name": { + "type": "keyword" + }, + "qualified_name": { + "type": "keyword" + }, + "username": { + "type": "keyword" + } + } + }, + "container": { + "type": "object", + "properties": { + "created": { + "type": "date", + "format": "date_optional_time||epoch_millis" + }, + "host": { + "type": "keyword" + }, + "id": { + "type": "long" + }, + "image": { + "properties": { + "date_formats": { + "properties": { + "created_at": { + "type": "date" + }, + "database_format": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "has_time": { + "type": "boolean" + }, + "id": { + "type": "long" + }, + "unix_format": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + } } - } - }, - "type": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + }, + "default_port": { + "type": "long" + }, + "dialect": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } } - } - } - } - }, - "contact": { - "type": "nested", - "properties": { - "firstname": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "lastname": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "qualified_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - }, - "container": { - "type": "nested", - "properties": { - "created": { - "type": "date", - "format": "date_optional_time||epoch_millis" - }, - "host": { - "type": "keyword" - }, - "id": { - "type": "long" - }, - "image": { - "type": "nested", - "properties": { - "id": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "version": { - "type": "keyword" + }, + "id": { + "type": "long" + }, + "jdbc_method": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "name": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "version": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } } } - }, - "internal_name": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "port": { - "type": "integer" - }, - "sidecar_host": { - "type": "keyword" - }, - "sidecar_port": { - "type": "integer" - }, - "ui_host": { - "type": "keyword" - }, - "ui_port": { - "type": "integer" } + }, + "internal_name": { + "type": "keyword" + }, + "name": { + "type": "keyword" + }, + "port": { + "type": "integer" + }, + "sidecar_host": { + "type": "keyword" + }, + "sidecar_port": { + "type": "integer" + }, + "ui_host": { + "type": "keyword" + }, + "ui_port": { + "type": "integer" } - }, - "created": { - "type": "date", - "format": "date_optional_time||epoch_millis" - }, - "description": { - "type": "text" - }, - "exchange_name": { - "type": "keyword" - }, - "exchange_type": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "identifiers": { - "type": "nested", - "properties": { - "created": { - "type": "date", - "format": "date_optional_time||epoch_millis" - }, - "creator": { - "type": "nested", - "properties": { - "firstname": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "lastname": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "qualified_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } + } + }, + "created": { + "type": "date", + "format": "date_optional_time||epoch_millis" + }, + "description": { + "type": "text" + }, + "exchange_name": { + "type": "keyword" + }, + "exchange_type": { + "type": "keyword" + }, + "id": { + "type": "keyword" + }, + "identifiers": { + "type": "object", + "properties": { + "created": { + "type": "date", + "format": "date_optional_time||epoch_millis" + }, + "creators": { + "type": "object", + "properties": { + "affiliation": { + "type": "keyword" + }, + "affiliation_identifier": { + "type": "keyword" + }, + "affiliation_identifier_scheme": { + "type": "keyword" + }, + "affiliation_identifier_scheme_uri": { + "type": "keyword" + }, + "creator_name": { + "type": "text" + }, + "firstname": { + "type": "text" + }, + "id": { + "type": "keyword" + }, + "lastname": { + "type": "text" + }, + "name_identifier": { + "type": "keyword" + }, + "name_identifier_scheme": { + "type": "keyword" + }, + "name_identifier_scheme_uri": { + "type": "keyword" + }, + "name_type": { + "type": "keyword" } - }, - "creators": { - "type": "nested", - "properties": { - "affiliation": { - "type": "keyword" - }, - "affiliation_identifier": { - "type": "keyword" - }, - "affiliation_identifier_scheme": { - "type": "keyword" - }, - "affiliation_identifier_scheme_uri": { - "type": "keyword" - }, - "creator_name": { - "type": "text" - }, - "firstname": { - "type": "text" - }, - "id": { - "type": "keyword" - }, - "lastname": { - "type": "text" - }, - "name_identifier": { - "type": "keyword" - }, - "name_identifier_scheme": { - "type": "keyword" - }, - "name_identifier_scheme_uri": { - "type": "keyword" - }, - "name_type": { - "type": "keyword" - } + } + }, + "database_id": { + "type": "keyword" + }, + "descriptions": { + "type": "object", + "properties": { + "description": { + "type": "text" + }, + "id": { + "type": "keyword" + }, + "language": { + "type": "keyword" + }, + "type": { + "type": "keyword" } - }, - "database_id": { - "type": "keyword" - }, - "descriptions": { - "type": "nested", - "properties": { - "description": { - "type": "text" - }, - "id": { - "type": "keyword" - }, - "language": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } + } + }, + "doi": { + "type": "keyword" + }, + "execution": { + "type": "date", + "format": "date_optional_time||epoch_millis" + }, + "funders": { + "type": "object", + "properties": { + "award_number": { + "type": "keyword" + }, + "award_title": { + "type": "keyword" + }, + "funder_identifier": { + "type": "keyword" + }, + "funder_identifier_type": { + "type": "keyword" + }, + "funder_name": { + "type": "keyword" + }, + "id": { + "type": "keyword" + }, + "scheme_uri": { + "type": "keyword" } - }, - "doi": { - "type": "keyword" - }, - "execution": { - "type": "date", - "format": "date_optional_time||epoch_millis" - }, - "funders": { - "type": "nested", - "properties": { - "award_number": { - "type": "keyword" - }, - "award_title": { - "type": "keyword" - }, - "funder_identifier": { - "type": "keyword" - }, - "funder_identifier_type": { - "type": "keyword" - }, - "funder_name": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "scheme_uri": { - "type": "keyword" - } + } + }, + "id": { + "type": "keyword" + }, + "language": { + "type": "keyword" + }, + "licenses": { + "type": "object", + "properties": { + "identifier": { + "type": "keyword" + }, + "uri": { + "type": "keyword" } - }, - "id": { - "type": "keyword" - }, - "language": { - "type": "keyword" - }, - "licenses": { - "type": "nested" - }, - "publication_day": { - "type": "integer" - }, - "publication_month": { - "type": "integer" - }, - "publication_year": { - "type": "integer" - }, - "publisher": { - "type": "text" - }, - "query": { - "type": "text" - }, - "query_hash": { - "type": "text" - }, - "query_id": { - "type": "keyword" - }, - "query_normalized": { - "type": "text" - }, - "related_identifiers": { - "type": "nested", - "properties": { - "created": { - "type": "date", - "format": "date_optional_time||epoch_millis" - }, - "id": { - "type": "keyword" - }, - "relation": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "value": { - "type": "keyword" - } + } + }, + "publication_day": { + "type": "integer" + }, + "publication_month": { + "type": "integer" + }, + "publication_year": { + "type": "integer" + }, + "publisher": { + "type": "text" + }, + "query": { + "type": "text" + }, + "query_hash": { + "type": "text" + }, + "query_id": { + "type": "keyword" + }, + "query_normalized": { + "type": "text" + }, + "related_identifiers": { + "type": "object", + "properties": { + "created": { + "type": "date", + "format": "date_optional_time||epoch_millis" + }, + "id": { + "type": "keyword" + }, + "relation": { + "type": "keyword" + }, + "type": { + "type": "keyword" + }, + "value": { + "type": "keyword" } - }, - "result_hash": { - "type": "text" - }, - "result_number": { - "type": "long" - }, - "table_id": { - "type": "keyword" - }, - "titles": { - "type": "nested", - "properties": { - "id": { - "type": "keyword" - }, - "language": { - "type": "keyword" - }, - "title": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } + } + }, + "result_hash": { + "type": "text" + }, + "result_number": { + "type": "long" + }, + "table_id": { + "type": "keyword" + }, + "titles": { + "type": "object", + "properties": { + "id": { + "type": "keyword" + }, + "language": { + "type": "keyword" + }, + "title": { + "type": "keyword" + }, + "type": { + "type": "keyword" } - }, - "type": { - "type": "keyword" - }, - "view_id": { - "type": "keyword" } + }, + "type": { + "type": "keyword" + }, + "view_id": { + "type": "keyword" } - }, - "internal_name": { - "type": "keyword" - }, - "is_public": { - "type": "boolean" - }, - "name": { - "type": "keyword" - }, - "owner": { - "type": "nested", - "properties": { - "firstname": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "lastname": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "qualified_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } + } + }, + "internal_name": { + "type": "keyword" + }, + "is_public": { + "type": "boolean" + }, + "name": { + "type": "keyword" + }, + "owner": { + "type": "object", + "properties": { + "firstname": { + "type": "keyword" + }, + "id": { + "type": "keyword" + }, + "lastname": { + "type": "keyword" + }, + "name": { + "type": "keyword" + }, + "qualified_name": { + "type": "keyword" + }, + "username": { + "type": "keyword" } - }, - "subsets": { - "type": "nested", - "properties": { - "created": { - "type": "date", - "format": "date_optional_time||epoch_millis" - }, - "creator": { - "type": "nested", - "properties": { - "firstname": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "lastname": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "qualified_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } + } + }, + "subsets": { + "type": "object", + "properties": { + "created": { + "type": "date", + "format": "date_optional_time||epoch_millis" + }, + "creators": { + "type": "object", + "properties": { + "affiliation": { + "type": "keyword" + }, + "affiliation_identifier": { + "type": "keyword" + }, + "affiliation_identifier_scheme": { + "type": "keyword" + }, + "affiliation_identifier_scheme_uri": { + "type": "keyword" + }, + "creator_name": { + "type": "text" + }, + "firstname": { + "type": "text" + }, + "id": { + "type": "keyword" + }, + "lastname": { + "type": "text" + }, + "name_identifier": { + "type": "keyword" + }, + "name_identifier_scheme": { + "type": "keyword" + }, + "name_identifier_scheme_uri": { + "type": "keyword" + }, + "name_type": { + "type": "keyword" } - }, - "creators": { - "type": "nested", - "properties": { - "affiliation": { - "type": "keyword" - }, - "affiliation_identifier": { - "type": "keyword" - }, - "affiliation_identifier_scheme": { - "type": "keyword" - }, - "affiliation_identifier_scheme_uri": { - "type": "keyword" - }, - "creator_name": { - "type": "text" - }, - "firstname": { - "type": "text" - }, - "id": { - "type": "keyword" - }, - "lastname": { - "type": "text" - }, - "name_identifier": { - "type": "keyword" - }, - "name_identifier_scheme": { - "type": "keyword" - }, - "name_identifier_scheme_uri": { - "type": "keyword" - }, - "name_type": { - "type": "keyword" - } + } + }, + "database_id": { + "type": "keyword" + }, + "descriptions": { + "type": "object", + "properties": { + "description": { + "type": "text" + }, + "id": { + "type": "keyword" + }, + "language": { + "type": "keyword" + }, + "type": { + "type": "keyword" } - }, - "database_id": { - "type": "keyword" - }, - "descriptions": { - "type": "nested", - "properties": { - "description": { - "type": "text" - }, - "id": { - "type": "keyword" - }, - "language": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } + } + }, + "doi": { + "type": "keyword" + }, + "execution": { + "type": "date", + "format": "date_optional_time||epoch_millis" + }, + "funders": { + "type": "object", + "properties": { + "award_number": { + "type": "keyword" + }, + "award_title": { + "type": "keyword" + }, + "funder_identifier": { + "type": "keyword" + }, + "funder_identifier_type": { + "type": "keyword" + }, + "funder_name": { + "type": "keyword" + }, + "id": { + "type": "keyword" + }, + "scheme_uri": { + "type": "keyword" } - }, - "doi": { - "type": "keyword" - }, - "execution": { - "type": "date", - "format": "date_optional_time||epoch_millis" - }, - "funders": { - "type": "nested", - "properties": { - "award_number": { - "type": "keyword" - }, - "award_title": { - "type": "keyword" - }, - "funder_identifier": { - "type": "keyword" - }, - "funder_identifier_type": { - "type": "keyword" - }, - "funder_name": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "scheme_uri": { - "type": "keyword" - } + } + }, + "id": { + "type": "keyword" + }, + "language": { + "type": "keyword" + }, + "licenses": { + "type": "object", + "properties": { + "identifier": { + "type": "keyword" + }, + "uri": { + "type": "keyword" } - }, - "id": { - "type": "keyword" - }, - "language": { - "type": "keyword" - }, - "licenses": { - "type": "nested" - }, - "publication_day": { - "type": "integer" - }, - "publication_month": { - "type": "integer" - }, - "publication_year": { - "type": "integer" - }, - "publisher": { - "type": "text" - }, - "query": { - "type": "text" - }, - "query_hash": { - "type": "text" - }, - "query_id": { - "type": "keyword" - }, - "query_normalized": { - "type": "text" - }, - "related_identifiers": { - "type": "nested", - "properties": { - "created": { - "type": "date", - "format": "date_optional_time||epoch_millis" - }, - "id": { - "type": "keyword" - }, - "relation": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "value": { - "type": "keyword" - } + } + }, + "publication_day": { + "type": "integer" + }, + "publication_month": { + "type": "integer" + }, + "publication_year": { + "type": "integer" + }, + "publisher": { + "type": "text" + }, + "query": { + "type": "text" + }, + "query_hash": { + "type": "text" + }, + "query_id": { + "type": "keyword" + }, + "query_normalized": { + "type": "text" + }, + "related_identifiers": { + "type": "object", + "properties": { + "created": { + "type": "date", + "format": "date_optional_time||epoch_millis" + }, + "id": { + "type": "keyword" + }, + "relation": { + "type": "keyword" + }, + "type": { + "type": "keyword" + }, + "value": { + "type": "keyword" } - }, - "result_hash": { - "type": "text" - }, - "result_number": { - "type": "long" - }, - "table_id": { - "type": "keyword" - }, - "titles": { - "type": "nested", - "properties": { - "id": { - "type": "keyword" - }, - "language": { - "type": "keyword" - }, - "title": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } + } + }, + "result_hash": { + "type": "text" + }, + "result_number": { + "type": "long" + }, + "table_id": { + "type": "keyword" + }, + "titles": { + "type": "object", + "properties": { + "id": { + "type": "keyword" + }, + "language": { + "type": "keyword" + }, + "title": { + "type": "keyword" + }, + "type": { + "type": "keyword" } - }, - "type": { - "type": "keyword" - }, - "view_id": { - "type": "keyword" } + }, + "type": { + "type": "keyword" + }, + "view_id": { + "type": "keyword" } - }, - "tables": { - "type": "nested", - "properties": { - "constraints": { - "type": "nested", - "properties": { - "foreign_keys": { - "type": "nested", - "properties": { - "on_delete": { - "type": "keyword" - }, - "on_update": { - "type": "keyword" - } + } + }, + "tables": { + "type": "object", + "properties": { + "columns": { + "properties": { + "auto_generated": { + "type": "boolean" + }, + "column_type": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 } - }, - "uniques": { - "type": "nested", - "properties": { - "id": { - "type": "keyword" - } + } + }, + "concept": { + "type": "object", + "properties": { + "created": { + "type": "date" + }, + "id": { + "type": "long" + }, + "uri": { + "type": "keyword" + } + } + }, + "database_id": { + "type": "long" + }, + "description": { + "type": "text" + }, + "id": { + "type": "long" + }, + "internal_name": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "is_null_allowed": { + "type": "boolean" + }, + "is_primary_key": { + "type": "boolean" + }, + "is_public": { + "type": "boolean" + }, + "name": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "size": { + "type": "long" + }, + "table_id": { + "type": "long" + }, + "unit": { + "type": "object", + "properties": { + "created": { + "type": "date" + }, + "id": { + "type": "long" + }, + "uri": { + "type": "keyword" } } } - }, - "created": { - "type": "date", - "format": "date_optional_time||epoch_millis" - }, - "creator": { - "type": "nested", - "properties": { - "firstname": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "lastname": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "qualified_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" + } + }, + "constraints": { + "type": "object", + "properties": { + "checks": { + "type": "object" + }, + "foreign_keys": { + "type": "object", + "properties": { + "on_delete": { + "type": "keyword" + }, + "on_update": { + "type": "keyword" + } + } + }, + "uniques": { + "type": "object", + "properties": { + "id": { + "type": "keyword" + } } } - }, - "database_id": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "id": { - "type": "keyword" - }, - "identifiers": { - "type": "nested", - "properties": { - "created": { - "type": "date", - "format": "date_optional_time||epoch_millis" - }, - "creator": { - "type": "nested", - "properties": { - "firstname": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "lastname": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "qualified_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } + } + }, + "created": { + "type": "date", + "format": "date_optional_time||epoch_millis" + }, + "database_id": { + "type": "keyword" + }, + "description": { + "type": "text" + }, + "id": { + "type": "keyword" + }, + "identifiers": { + "type": "object", + "properties": { + "created": { + "type": "date", + "format": "date_optional_time||epoch_millis" + }, + "creators": { + "type": "object", + "properties": { + "affiliation": { + "type": "keyword" + }, + "affiliation_identifier": { + "type": "keyword" + }, + "affiliation_identifier_scheme": { + "type": "keyword" + }, + "affiliation_identifier_scheme_uri": { + "type": "keyword" + }, + "creator_name": { + "type": "text" + }, + "firstname": { + "type": "text" + }, + "id": { + "type": "keyword" + }, + "lastname": { + "type": "text" + }, + "name_identifier": { + "type": "keyword" + }, + "name_identifier_scheme": { + "type": "keyword" + }, + "name_identifier_scheme_uri": { + "type": "keyword" + }, + "name_type": { + "type": "keyword" } - }, - "creators": { - "type": "nested", - "properties": { - "affiliation": { - "type": "keyword" - }, - "affiliation_identifier": { - "type": "keyword" - }, - "affiliation_identifier_scheme": { - "type": "keyword" - }, - "affiliation_identifier_scheme_uri": { - "type": "keyword" - }, - "creator_name": { - "type": "text" - }, - "firstname": { - "type": "text" - }, - "id": { - "type": "keyword" - }, - "lastname": { - "type": "text" - }, - "name_identifier": { - "type": "keyword" - }, - "name_identifier_scheme": { - "type": "keyword" - }, - "name_identifier_scheme_uri": { - "type": "keyword" - }, - "name_type": { - "type": "keyword" - } + } + }, + "database_id": { + "type": "keyword" + }, + "descriptions": { + "type": "object", + "properties": { + "description": { + "type": "text" + }, + "id": { + "type": "keyword" + }, + "language": { + "type": "keyword" + }, + "type": { + "type": "keyword" } - }, - "database_id": { - "type": "keyword" - }, - "descriptions": { - "type": "nested", - "properties": { - "description": { - "type": "text" - }, - "id": { - "type": "keyword" - }, - "language": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } + } + }, + "doi": { + "type": "keyword" + }, + "execution": { + "type": "date", + "format": "date_optional_time||epoch_millis" + }, + "funders": { + "type": "object", + "properties": { + "award_number": { + "type": "keyword" + }, + "award_title": { + "type": "keyword" + }, + "funder_identifier": { + "type": "keyword" + }, + "funder_identifier_type": { + "type": "keyword" + }, + "funder_name": { + "type": "keyword" + }, + "id": { + "type": "keyword" + }, + "scheme_uri": { + "type": "keyword" } - }, - "doi": { - "type": "keyword" - }, - "execution": { - "type": "date", - "format": "date_optional_time||epoch_millis" - }, - "funders": { - "type": "nested", - "properties": { - "award_number": { - "type": "keyword" - }, - "award_title": { - "type": "keyword" - }, - "funder_identifier": { - "type": "keyword" - }, - "funder_identifier_type": { - "type": "keyword" - }, - "funder_name": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "scheme_uri": { - "type": "keyword" - } + } + }, + "id": { + "type": "keyword" + }, + "language": { + "type": "keyword" + }, + "licenses": { + "type": "object", + "properties": { + "identifier": { + "type": "keyword" + }, + "uri": { + "type": "keyword" } - }, - "id": { - "type": "keyword" - }, - "language": { - "type": "keyword" - }, - "licenses": { - "type": "nested" - }, - "publication_day": { - "type": "integer" - }, - "publication_month": { - "type": "integer" - }, - "publication_year": { - "type": "integer" - }, - "publisher": { - "type": "text" - }, - "query": { - "type": "text" - }, - "query_hash": { - "type": "text" - }, - "query_id": { - "type": "keyword" - }, - "query_normalized": { - "type": "text" - }, - "related_identifiers": { - "type": "nested", - "properties": { - "created": { - "type": "date", - "format": "date_optional_time||epoch_millis" - }, - "id": { - "type": "keyword" - }, - "relation": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "value": { - "type": "keyword" - } + } + }, + "publication_day": { + "type": "integer" + }, + "publication_month": { + "type": "integer" + }, + "publication_year": { + "type": "integer" + }, + "publisher": { + "type": "text" + }, + "query": { + "type": "text" + }, + "query_hash": { + "type": "text" + }, + "query_id": { + "type": "keyword" + }, + "query_normalized": { + "type": "text" + }, + "related_identifiers": { + "type": "object", + "properties": { + "created": { + "type": "date", + "format": "date_optional_time||epoch_millis" + }, + "id": { + "type": "keyword" + }, + "relation": { + "type": "keyword" + }, + "type": { + "type": "keyword" + }, + "value": { + "type": "keyword" } - }, - "result_hash": { - "type": "text" - }, - "result_number": { - "type": "long" - }, - "table_id": { - "type": "keyword" - }, - "titles": { - "type": "nested", - "properties": { - "id": { - "type": "keyword" - }, - "language": { - "type": "keyword" - }, - "title": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } + } + }, + "result_hash": { + "type": "text" + }, + "result_number": { + "type": "long" + }, + "table_id": { + "type": "keyword" + }, + "titles": { + "type": "object", + "properties": { + "id": { + "type": "keyword" + }, + "language": { + "type": "keyword" + }, + "title": { + "type": "keyword" + }, + "type": { + "type": "keyword" } - }, - "type": { - "type": "keyword" - }, - "view_id": { - "type": "keyword" } + }, + "type": { + "type": "keyword" + }, + "view_id": { + "type": "keyword" } - }, - "internal_name": { - "type": "keyword" - }, - "is_public": { - "type": "boolean" - }, - "is_versioned": { - "type": "boolean" - }, - "name": { - "type": "keyword" - }, - "owner": { - "type": "nested", - "properties": { - "firstname": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "lastname": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "qualified_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } + } + }, + "internal_name": { + "type": "keyword" + }, + "is_public": { + "type": "boolean" + }, + "is_versioned": { + "type": "boolean" + }, + "name": { + "type": "keyword" + }, + "owner": { + "type": "object", + "properties": { + "firstname": { + "type": "keyword" + }, + "id": { + "type": "keyword" + }, + "lastname": { + "type": "keyword" + }, + "name": { + "type": "keyword" + }, + "qualified_name": { + "type": "keyword" + }, + "username": { + "type": "keyword" } - }, - "queue_name": { - "type": "keyword" - }, - "queue_type": { - "type": "keyword" - }, - "routing_key": { - "type": "keyword" } + }, + "queue_name": { + "type": "keyword" + }, + "queue_type": { + "type": "keyword" + }, + "routing_key": { + "type": "keyword" } - }, - "views": { - "type": "nested", - "properties": { - "created": { - "type": "date", - "format": "date_optional_time||epoch_millis" - }, - "database_id": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "identifiers": { - "type": "nested", - "properties": { - "created": { - "type": "date", - "format": "date_optional_time||epoch_millis" - }, - "creator": { - "type": "nested", - "properties": { - "firstname": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "lastname": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "qualified_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } + } + }, + "views": { + "type": "object", + "properties": { + "created": { + "type": "date", + "format": "date_optional_time||epoch_millis" + }, + "database_id": { + "type": "keyword" + }, + "id": { + "type": "keyword" + }, + "identifiers": { + "type": "object", + "properties": { + "created": { + "type": "date", + "format": "date_optional_time||epoch_millis" + }, + "creators": { + "type": "object", + "properties": { + "affiliation": { + "type": "keyword" + }, + "affiliation_identifier": { + "type": "keyword" + }, + "affiliation_identifier_scheme": { + "type": "keyword" + }, + "affiliation_identifier_scheme_uri": { + "type": "keyword" + }, + "creator_name": { + "type": "text" + }, + "firstname": { + "type": "text" + }, + "id": { + "type": "keyword" + }, + "lastname": { + "type": "text" + }, + "name_identifier": { + "type": "keyword" + }, + "name_identifier_scheme": { + "type": "keyword" + }, + "name_identifier_scheme_uri": { + "type": "keyword" + }, + "name_type": { + "type": "keyword" } - }, - "creators": { - "type": "nested", - "properties": { - "affiliation": { - "type": "keyword" - }, - "affiliation_identifier": { - "type": "keyword" - }, - "affiliation_identifier_scheme": { - "type": "keyword" - }, - "affiliation_identifier_scheme_uri": { - "type": "keyword" - }, - "creator_name": { - "type": "text" - }, - "firstname": { - "type": "text" - }, - "id": { - "type": "keyword" - }, - "lastname": { - "type": "text" - }, - "name_identifier": { - "type": "keyword" - }, - "name_identifier_scheme": { - "type": "keyword" - }, - "name_identifier_scheme_uri": { - "type": "keyword" - }, - "name_type": { - "type": "keyword" - } + } + }, + "database_id": { + "type": "keyword" + }, + "descriptions": { + "type": "object", + "properties": { + "description": { + "type": "text" + }, + "id": { + "type": "keyword" + }, + "language": { + "type": "keyword" + }, + "type": { + "type": "keyword" } - }, - "database_id": { - "type": "keyword" - }, - "descriptions": { - "type": "nested", - "properties": { - "description": { - "type": "text" - }, - "id": { - "type": "keyword" - }, - "language": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } + } + }, + "doi": { + "type": "keyword" + }, + "execution": { + "type": "date", + "format": "date_optional_time||epoch_millis" + }, + "funders": { + "type": "object", + "properties": { + "award_number": { + "type": "keyword" + }, + "award_title": { + "type": "keyword" + }, + "funder_identifier": { + "type": "keyword" + }, + "funder_identifier_type": { + "type": "keyword" + }, + "funder_name": { + "type": "keyword" + }, + "id": { + "type": "keyword" + }, + "scheme_uri": { + "type": "keyword" } - }, - "doi": { - "type": "keyword" - }, - "execution": { - "type": "date", - "format": "date_optional_time||epoch_millis" - }, - "funders": { - "type": "nested", - "properties": { - "award_number": { - "type": "keyword" - }, - "award_title": { - "type": "keyword" - }, - "funder_identifier": { - "type": "keyword" - }, - "funder_identifier_type": { - "type": "keyword" - }, - "funder_name": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "scheme_uri": { - "type": "keyword" - } + } + }, + "id": { + "type": "keyword" + }, + "language": { + "type": "keyword" + }, + "licenses": { + "type": "object", + "properties": { + "identifier": { + "type": "keyword" + }, + "uri": { + "type": "keyword" } - }, - "id": { - "type": "keyword" - }, - "language": { - "type": "keyword" - }, - "licenses": { - "type": "nested" - }, - "publication_day": { - "type": "integer" - }, - "publication_month": { - "type": "integer" - }, - "publication_year": { - "type": "integer" - }, - "publisher": { - "type": "text" - }, - "query": { - "type": "text" - }, - "query_hash": { - "type": "text" - }, - "query_id": { - "type": "keyword" - }, - "query_normalized": { - "type": "text" - }, - "related_identifiers": { - "type": "nested", - "properties": { - "created": { - "type": "date", - "format": "date_optional_time||epoch_millis" - }, - "id": { - "type": "keyword" - }, - "relation": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "value": { - "type": "keyword" - } + } + }, + "publication_day": { + "type": "integer" + }, + "publication_month": { + "type": "integer" + }, + "publication_year": { + "type": "integer" + }, + "publisher": { + "type": "text" + }, + "query": { + "type": "text" + }, + "query_hash": { + "type": "text" + }, + "query_id": { + "type": "keyword" + }, + "query_normalized": { + "type": "text" + }, + "related_identifiers": { + "type": "object", + "properties": { + "created": { + "type": "date", + "format": "date_optional_time||epoch_millis" + }, + "id": { + "type": "keyword" + }, + "relation": { + "type": "keyword" + }, + "type": { + "type": "keyword" + }, + "value": { + "type": "keyword" } - }, - "result_hash": { - "type": "text" - }, - "result_number": { - "type": "long" - }, - "table_id": { - "type": "keyword" - }, - "titles": { - "type": "nested", - "properties": { - "id": { - "type": "keyword" - }, - "language": { - "type": "keyword" - }, - "title": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } + } + }, + "result_hash": { + "type": "text" + }, + "result_number": { + "type": "long" + }, + "table_id": { + "type": "keyword" + }, + "titles": { + "type": "object", + "properties": { + "id": { + "type": "keyword" + }, + "language": { + "type": "keyword" + }, + "title": { + "type": "keyword" + }, + "type": { + "type": "keyword" } - }, - "type": { - "type": "keyword" - }, - "view_id": { - "type": "keyword" } + }, + "type": { + "type": "keyword" + }, + "view_id": { + "type": "keyword" } - }, - "initial_view": { - "type": "boolean" - }, - "internal_name": { - "type": "keyword" - }, - "is_public": { - "type": "boolean" - }, - "name": { - "type": "keyword" - }, - "query": { - "type": "text" - }, - "query_hash": { - "type": "keyword" } + }, + "initial_view": { + "type": "boolean" + }, + "internal_name": { + "type": "keyword" + }, + "is_public": { + "type": "boolean" + }, + "name": { + "type": "keyword" + }, + "query": { + "type": "text" + }, + "query_hash": { + "type": "keyword" } } } - }, + } + }, "settings": { "index": { "number_of_shards": "1", diff --git a/dbrepo-search-service/app/api/routes.py b/dbrepo-search-service/app/api/routes.py index b220a8a81807ea9249aed4c7bc2e8db8f7048c70..d99a4c81ac15687374f48e432a4919c7df1f47dd 100644 --- a/dbrepo-search-service/app/api/routes.py +++ b/dbrepo-search-service/app/api/routes.py @@ -72,7 +72,6 @@ def get_index(index): }, 404 # ToDo: replace with better error handling results = query_index_by_term_opensearch("*", "contains") results = general_filter(index, results) - total_number_of_results = len(results) results_per_page = min(request.args.get("results_per_page", 50, type=int), 500) max_pages = math.ceil(len(results) / results_per_page) @@ -153,20 +152,25 @@ def post_general_search(type): if type == 'table': tmp = [] for database in response: - for table in database["tables"]: - table["is_public"] = database["is_public"] - tmp.append(table) + if database["tables"] is not None: + for table in database["tables"]: + table["is_public"] = database["is_public"] + tmp.append(table) response = tmp if type == 'identifier': tmp = [] for database in response: - for identifier in database['identifiers']: - tmp.append(identifier) - for identifier in database['subsets']: - tmp.append(identifier) - for table in database['tables']: - for identifier in table['identifiers']: + if database["identifiers"] is not None: + for identifier in database['identifiers']: tmp.append(identifier) + if database["subsets"] is not None: + for identifier in database['subsets']: + tmp.append(identifier) + if database["tables"] is not None: + for table in database['tables']: + if database["identifiers"] is not None: + for identifier in table['identifiers']: + tmp.append(identifier) for view in [x for xs in response for x in xs["views"]]: if 'identifier' in view: tmp.append(view['identifier']) diff --git a/dbrepo-search-service/app/opensearch_client.py b/dbrepo-search-service/app/opensearch_client.py index 27be6168ecaa89eb6e802fd333a74f015b70801a..056cef8feecbca7783505b5be688394a149b4358 100644 --- a/dbrepo-search-service/app/opensearch_client.py +++ b/dbrepo-search-service/app/opensearch_client.py @@ -211,15 +211,9 @@ def general_search(type=None, search_term=None, t1=None, t2=None, field_value_pa else: if '.' in key: logging.debug(f'key {key} is nested: use nested query') - index = key.split('.')[0] musts.append({ - "nested": { - "path": index, - "query": { - "term": { - key: value - } - } + "match": { + key: value } }) else: diff --git a/dbrepo-ui/api/identifier.mapper.js b/dbrepo-ui/api/identifier.mapper.js index 868535f88d2b9ec96a3a797b1eba27ffe503d5f0..1d0da950aacc43bb38d2eb23ea3b11443bcefbf4 100644 --- a/dbrepo-ui/api/identifier.mapper.js +++ b/dbrepo-ui/api/identifier.mapper.js @@ -219,13 +219,23 @@ class IdentifierMapper { const identifier = database.identifiers[0] const partIdentifiers = [] if (database.subsets.length > 0) { - database.subsets.forEach((s) => { if (s.identifiers.length > 0) { s.identifiers.forEach(i => partIdentifiers.push(i)) } }) + database.subsets.forEach((s) => { + partIdentifiers.push(s) + }) } if (database.tables.length > 0) { - database.tables.forEach((t) => { if (t.identifiers.length > 0) { t.identifiers.forEach(i => partIdentifiers.push(i)) } }) + database.tables.forEach((t) => { + if (t.identifiers.length > 0) { + t.identifiers.forEach(i => partIdentifiers.push(i)) + } + }) } if (database.views.length > 0) { - database.views.forEach((v) => { if (v.identifiers.length > 0) { v.identifiers.forEach(i => partIdentifiers.push(i)) } }) + database.views.forEach((v) => { + if (v.identifiers.length > 0) { + v.identifiers.forEach(i => partIdentifiers.push(i)) + } + }) } return { '@context': 'https://schema.org/', diff --git a/dbrepo-ui/components/search/AdvancedSearch.vue b/dbrepo-ui/components/search/AdvancedSearch.vue index dd0273e45afd49af6264832d4c3f5469c7fc4203..7457f753e756598f326acfdfd64b2d66db0fdcdb 100644 --- a/dbrepo-ui/components/search/AdvancedSearch.vue +++ b/dbrepo-ui/components/search/AdvancedSearch.vue @@ -96,37 +96,37 @@ clearable /> </v-col> </v-row> - <p v-if="isEligibleConceptOrUnitSearch" class="mt-4"> + <p v-if="isEligibleUnitIndependentSearch" class="mt-4"> If you select a <code>concept</code> and <code>unit</code>, you can search across columns regardless of their unit of measurement. </p> - <v-row v-if="isEligibleConceptOrUnitSearch" dense> - <v-col cols="3"> + <v-row v-if="isEligibleConceptOrUnitSearch || isEligibleUnitIndependentSearch" dense> + <v-col v-if="isEligibleConceptOrUnitSearch || isEligibleUnitIndependentSearch" cols="3"> <v-select - v-model="advancedSearchData['concept.uri']" + v-model="advancedSearchData['tables.columns.concept.uri']" clearable :items="concepts" item-text="name" item-value="uri" label="Concept" /> </v-col> - <v-col cols="3"> + <v-col v-if="isEligibleConceptOrUnitSearch || isEligibleUnitIndependentSearch" cols="3"> <v-select - v-model="advancedSearchData['unit.uri']" + v-model="advancedSearchData['tables.columns.unit.uri']" clearable :items="units" item-text="name" item-value="uri" label="Unit" /> </v-col> - <v-col cols="3"> + <v-col v-if="isEligibleUnitIndependentSearch" cols="3"> <v-text-field v-model="advancedSearchData['t1']" clearable type="number" label="Start Value" /> </v-col> - <v-col cols="3"> + <v-col v-if="isEligibleUnitIndependentSearch" cols="3"> <v-text-field v-model="advancedSearchData['t2']" clearable @@ -221,6 +221,9 @@ export default { } }, isEligibleConceptOrUnitSearch () { + return ['column', 'database'].includes(this.searchType) + }, + isEligibleUnitIndependentSearch () { return ['column'].includes(this.searchType) }, isEligibleYearRangeSearch () {