Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static no.unit.nva.constants.Words.MESSAGES_INDEX;
import static no.unit.nva.constants.Words.PUBLISHING_REQUESTS_INDEX;
import static no.unit.nva.constants.Words.RESOURCES;
import static no.unit.nva.constants.Words.RESOURCES_20241201;
import static no.unit.nva.constants.Words.TICKETS;

import static nva.commons.core.attempt.Try.attempt;
Expand Down Expand Up @@ -38,6 +39,8 @@ public String handleRequest(Object input, Context context) {

attempt(() -> indexingClient.deleteIndex(RESOURCES))
.orElse(fail -> logError(fail.getException()));
attempt(() -> indexingClient.deleteIndex(RESOURCES_20241201))
.orElse(fail -> logError(fail.getException()));
attempt(() -> indexingClient.deleteIndex(DOIREQUESTS_INDEX))
.orElse(fail -> logError(fail.getException()));
attempt(() -> indexingClient.deleteIndex(MESSAGES_INDEX))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static no.unit.nva.constants.Words.MESSAGES_INDEX;
import static no.unit.nva.constants.Words.PUBLISHING_REQUESTS_INDEX;
import static no.unit.nva.constants.Words.RESOURCES;
import static no.unit.nva.constants.Words.RESOURCES_20241201;
import static no.unit.nva.constants.Words.TICKETS;
import static no.unit.nva.indexingclient.IndexingClient.defaultIndexingClient;

Expand Down Expand Up @@ -34,11 +35,19 @@ public class InitHandler implements RequestHandler<Object, String> {
IoUtils.stringFromResources(Path.of("ticket_mappings.json"));
private static final String RESOURCE_MAPPINGS =
IoUtils.stringFromResources(Path.of("resource_mappings.json"));
private static final String RESOURCE_20241201_MAPPINGS =
IoUtils.stringFromResources(Path.of("resource_20241201_mappings.json"));
private static final String RESOURCE_SETTINGS =
IoUtils.stringFromResources(Path.of("resource_settings.json"));
private static final String RESOURCE_20241201_SETTINGS =
IoUtils.stringFromResources(Path.of("resource_20241201_settings.json"));

private static final List<IndexRequest> INDEXES =
List.of(
new IndexRequest(
RESOURCES_20241201,
RESOURCE_20241201_MAPPINGS,
RESOURCE_20241201_SETTINGS),
new IndexRequest(RESOURCES, RESOURCE_MAPPINGS, RESOURCE_SETTINGS),
new IndexRequest(DOIREQUESTS_INDEX),
new IndexRequest(MESSAGES_INDEX),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"properties": {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"mapping": {
"total_fields": {
"limit": "1100"
}
},
"analysis": {
"char_filter": {
"quote": {
"type": "mapping",
"mappings": [
"« => \"",
"» => \"",
"\"\" => \""
]
}
},
"filter": {
"standard_nva_filter": {
"type": "asciifolding",
"preserve_original": true
}
},
"analyzer": {
"default": {
"type": "custom",
"tokenizer": "standard",
"char_filter": [
"html_strip",
"quote"
],
"filter": [
"lowercase",
"standard_nva_filter",
"scandinavian_normalization"
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import static no.unit.nva.constants.Words.MESSAGES_INDEX;
import static no.unit.nva.constants.Words.PUBLISHING_REQUESTS_INDEX;
import static no.unit.nva.constants.Words.RESOURCES;
import static no.unit.nva.constants.Words.RESOURCES_20241201;
import static no.unit.nva.constants.Words.TICKETS;
import static no.unit.nva.testutils.RandomDataGenerator.randomString;

Expand All @@ -28,6 +29,7 @@ class DeleteIndicesHandlerTest {
private static final List<String> ALL_INDICES =
List.of(
RESOURCES,
RESOURCES_20241201,
DOIREQUESTS_INDEX,
MESSAGES_INDEX,
TICKETS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public final class Words {
public static final String REFERENCE = "reference";
public static final String RELEVANCE_KEY_NAME = "relevance";
public static final String RESOURCES = "resources";
public static final String RESOURCES_20241201 = "resources-20241201";
public static final String RESOURCE_OWNER = "resourceOwner";
public static final String ROLE = "role";
public static final String ROOT = "root";
Expand Down
Loading