From 3e14d92c29e8e8b612ea511d186dff725c29102d Mon Sep 17 00:00:00 2001 From: Nordine Bittich <3816305+nbittich@users.noreply.github.com> Date: Mon, 7 Feb 2022 07:50:37 +0100 Subject: [PATCH] mu search page person (#97) --- config/delta/rules.js | 17 ++++ config/dispatcher/dispatcher.ex | 8 ++ config/search/config.json | 133 ++++++++++++++++++++++++++++++++ docker-compose.yml | 19 +++++ 4 files changed, 177 insertions(+) create mode 100644 config/search/config.json diff --git a/config/delta/rules.js b/config/delta/rules.js index c476cfb..c1d5575 100644 --- a/config/delta/rules.js +++ b/config/delta/rules.js @@ -1,4 +1,21 @@ export default [ + { + match: { + graph: { + type: "uri", + value: "http://mu.semte.ch/graphs/organisatieportaal" + } + }, + callback: { + url: 'http://search/update', + method: 'POST' + }, + options: { + resourceFormat: "v0.0.1", + gracePeriod: 10000, + ignoreFromSelf: true + } + }, { match: { predicate: { diff --git a/config/dispatcher/dispatcher.ex b/config/dispatcher/dispatcher.ex index fb94483..71e6750 100644 --- a/config/dispatcher/dispatcher.ex +++ b/config/dispatcher/dispatcher.ex @@ -221,7 +221,15 @@ defmodule Dispatcher do match "/sessions/*path", %{ accept: [:any], layer: :api} do Proxy.forward conn, path, "http://login/sessions/" end + + ############################################################### + # SEARCH + ############################################################### + match "/search/*path", %{ accept: %{ json: true }, layer: :api_services} do + IO.puts("hey") + Proxy.forward conn, path, "http://search/" + end ############### # API SERVICES diff --git a/config/search/config.json b/config/search/config.json new file mode 100644 index 0000000..d1da3ac --- /dev/null +++ b/config/search/config.json @@ -0,0 +1,133 @@ +{ + "automatic_index_updates": true, + "persist_indexes": true, + "number_of_threads": 10, + "eager_indexing_groups": [ + [{ "variables": [], "name": "acmidm-lezer" }], + [{ "variables": [], "name": "acmidm-editeerder" }], + [{ "variables": [], "name": "acmidm-beheerder" }] + ], + "types": [ + { + "type": "person", + "on_path": "people", + "rdf_type": "http://data.lblod.info/vocabularies/erediensten/EredienstMandataris", + "properties": { + "given_name": ["http://data.vlaanderen.be/ns/mandaat#isBestuurlijkeAliasVan","http://xmlns.com/foaf/0.1/givenName"], + "id": ["http://data.vlaanderen.be/ns/mandaat#isBestuurlijkeAliasVan","http://mu.semte.ch/vocabularies/core/uuid"], + "family_name": ["http://data.vlaanderen.be/ns/mandaat#isBestuurlijkeAliasVan","http://xmlns.com/foaf/0.1/familyName"], + "first_name_used": ["http://data.vlaanderen.be/ns/mandaat#isBestuurlijkeAliasVan","https://data.vlaanderen.be/ns/persoon#gebruikteVoornaam"], + "end_date": "http://data.vlaanderen.be/ns/mandaat#einde", + "organization_id": [ + "http://www.w3.org/ns/org#holds", + "^http://www.w3.org/ns/org#hasPost", + "https://data.vlaanderen.be/ns/generiek#isTijdspecialisatieVan", + "http://data.vlaanderen.be/ns/besluit#bestuurt", + "http://mu.semte.ch/vocabularies/core/uuid" + ], + "organization_name": [ + "http://www.w3.org/ns/org#holds", + "^http://www.w3.org/ns/org#hasPost", + "https://data.vlaanderen.be/ns/generiek#isTijdspecialisatieVan", + "http://data.vlaanderen.be/ns/besluit#bestuurt", + "http://www.w3.org/2004/02/skos/core#prefLabel" + ], + "organization_municipality": [ + "http://www.w3.org/ns/org#holds", + "^http://www.w3.org/ns/org#hasPost", + "https://data.vlaanderen.be/ns/generiek#isTijdspecialisatieVan", + "http://data.vlaanderen.be/ns/besluit#bestuurt", + "http://www.w3.org/ns/org#hasPrimarySite", + "https://data.vlaanderen.be/ns/organisatie#bestaatUit", + "https://data.vlaanderen.be/ns/adres#gemeentenaam" + ], + "organization_province": [ + "http://www.w3.org/ns/org#holds", + "^http://www.w3.org/ns/org#hasPost", + "https://data.vlaanderen.be/ns/generiek#isTijdspecialisatieVan", + "http://data.vlaanderen.be/ns/besluit#bestuurt", + "http://www.w3.org/ns/org#hasPrimarySite", + "https://data.vlaanderen.be/ns/organisatie#bestaatUit", + "http://www.w3.org/ns/locn#adminUnitL2" + ], + "position_id": [ + "http://www.w3.org/ns/org#holds", + "http://www.w3.org/ns/org#role", + "http://mu.semte.ch/vocabularies/core/uuid" + ], + "position_name": [ + "http://www.w3.org/ns/org#holds", + "http://www.w3.org/ns/org#role", + "http://www.w3.org/2004/02/skos/core#prefLabel" + ], + "planned_end_date": "https://data.lblod.info/vocabularies/erediensten/geplandeEinddatumAanstelling" + }, + + "mappings": { + "properties": { + "family_name": { + "type": "text", + "fields": { + "field": { + "type": "keyword" + } + } + }, + "id": { + "type": "text", + "fields": { + "field": { + "type": "keyword" + } + } + }, + "given_name": { + "type": "text", + "fields": { + "field": { + "type": "keyword" + } + } + }, + "organization_id": { "type": "text" }, + "organization_province": { + "type": "text", + "fields": { + "field": { + "type": "keyword" + } + } + }, + "organization_name": { + "type": "text", + "fields": { + "field": { + "type": "keyword" + } + } + }, + "organization_municipality": { + "type": "text", + "fields": { + "field": { + "type": "keyword" + } + } + }, + "position_id": { "type": "text" }, + "position_name": { + "type": "text", + "fields": { + "field": { + "type": "keyword" + } + } + }, + "end_date": { "type": "date" }, + "planned_end_date": { "type": "date" } + } + } + } + + ] +} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 0468789..fa9fbc4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -332,3 +332,22 @@ services: ################################################################################ # DELTA ORGANIZATIONS: END ################################################################################ + + +################################################################################ +# MU SEARCH - TODO USE THE CORRECT IMAGE ONCE INHERITANCE IS IN MU SEARCH +################################################################################ + search: + image: nbittich/mu-search:wip + links: + - db:database + volumes: + - ./config/search:/config + elasticsearch: + ports: + - "9200:9200" + image: semtech/mu-search-elastic-backend:latest + volumes: + - ./data/elasticsearch/:/usr/share/elasticsearch/data + environment: + - discovery.type=single-node \ No newline at end of file