Skip to content

Commit

Permalink
Oppdatert adressesøk II
Browse files Browse the repository at this point in the history
  • Loading branch information
krharum committed Jan 24, 2025
1 parent 2e0885d commit c10f747
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package no.nav.testnav.dollysearchservice.config;

import no.nav.testnav.libs.servletcore.config.ApplicationCoreConfig;
import no.nav.testnav.libs.servletsecurity.config.SecureOAuth2ServerToServerConfiguration;
import no.nav.testnav.libs.servletsecurity.jwt.SecureOAuth2ServerToServerAutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

@Configuration
@Import({
ApplicationCoreConfig.class,
SecureOAuth2ServerToServerConfiguration.class
SecureOAuth2ServerToServerAutoConfiguration.class
})
public class ApplicationConfig {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class OpenSearchPersonQueryUtils {
private static final String MATRIKKELADRESSE = "matrikkeladresse";
private static final String KOMMUNENUMMER = "kommunenummer";
private static final String POSTNUMMER = "postnummer";
private static final String BYDELSNUMMER = "bydelsnummer";
private static final String FOLKEREGISTERIDENTIFIKATOR = "hentPerson.folkeregisteridentifikator";
private static final String NAVSPERSONIDENTIFIKATOR = "hentPerson.navspersonidentifikator";
private static final String CONCAT = "%s.%s";
Expand Down Expand Up @@ -174,7 +175,6 @@ public static BoolQueryBuilder addAdresseQuery(String field, String value) {
.should(nestedMatchQuery(KONTAKTADRESSE, CONCAT.formatted(VEGADRESSE, field), value));
}


public static void addAdressePostnrQuery(BoolQueryBuilder queryBuilder, SearchRequest request) {

Optional.ofNullable(request.getPersonRequest().getAdresse())
Expand All @@ -188,11 +188,10 @@ public static void addAdressePostnrQuery(BoolQueryBuilder queryBuilder, SearchRe
public static void addAdresseBydelsnrQuery(BoolQueryBuilder queryBuilder, SearchRequest request) {

Optional.ofNullable(request.getPersonRequest().getAdresse())
.filter(boadresse -> isNotBlank(boadresse.getBydelsnummer()))
.ifPresent(boadresse ->
queryBuilder.must(QueryBuilders.nestedQuery("hentPerson.bostedsadresse.vegadresse",
QueryBuilders.boolQuery().must(matchQuery("hentPerson.bostedsadresse.vegadresse.bydelsnummer",
boadresse.getBydelsnummer())), ScoreMode.Avg)));
.filter(adresse -> isNotBlank(adresse.getBydelsnummer()))
.ifPresent(adresse ->
queryBuilder.must(addAdresseQuery(BYDELSNUMMER, adresse.getBydelsnummer())
));
}

public static void addHarAdresseBydelsnrQuery(BoolQueryBuilder queryBuilder, SearchRequest request) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AZURE_APP_CLIENT_ID: ${sm://azure-app-client-id}
AZURE_APP_CLIENT_SECRET: ${sm://azure-app-client-secret}
AZURE_APP_CLIENT_ID: ${sm\://azure-app-client-id}
AZURE_APP_CLIENT_SECRET: ${sm\://azure-app-client-secret}
TOKEN_X_ISSUER: https://tokenx.dev-gcp.nav.cloud.nais.io

spring:
Expand Down

0 comments on commit c10f747

Please sign in to comment.