From 259d142c74e2fbb44e6389cf9b95be56513d25d0 Mon Sep 17 00:00:00 2001 From: Quinten Van Assche Date: Thu, 25 Jan 2024 16:30:26 +0100 Subject: [PATCH] feat: or-2073 rework facets to work with mapping --- .../Search/SearchVerenigingenController.cs | 4 +++- .../Search/VerenigingZoekDocumentMapping.cs | 16 ++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/AssociationRegistry.Public.Api/Verenigingen/Search/SearchVerenigingenController.cs b/src/AssociationRegistry.Public.Api/Verenigingen/Search/SearchVerenigingenController.cs index 4db995c0a..efac8caef 100755 --- a/src/AssociationRegistry.Public.Api/Verenigingen/Search/SearchVerenigingenController.cs +++ b/src/AssociationRegistry.Public.Api/Verenigingen/Search/SearchVerenigingenController.cs @@ -262,7 +262,9 @@ private static AggregationContainerDescriptor Hoofdactiv return aggregationContainerDescriptor.Terms( WellknownFacets.HoofdactiviteitenCountAggregateName, selector: valueCountAggregationDescriptor => valueCountAggregationDescriptor - .Field(document => document.HoofdactiviteitenVerenigingsloket.Select(h => h.Code)) + .Field(document => document.HoofdactiviteitenVerenigingsloket.Select( + h => h.Code).Suffix("keyword") + ) .Size(size: 20) ); } diff --git a/src/AssociationRegistry.Public.Schema/Search/VerenigingZoekDocumentMapping.cs b/src/AssociationRegistry.Public.Schema/Search/VerenigingZoekDocumentMapping.cs index 79f37254f..915ccaa69 100644 --- a/src/AssociationRegistry.Public.Schema/Search/VerenigingZoekDocumentMapping.cs +++ b/src/AssociationRegistry.Public.Schema/Search/VerenigingZoekDocumentMapping.cs @@ -7,13 +7,12 @@ public static class VerenigingZoekDocumentMapping public const string PubliekZoekenNormalizer = "publiek_zoeken_normalizer"; public const string PubliekZoekenAnalyzer = "publiek_zoeken_analyzer"; - public static TypeMappingDescriptor Get(TypeMappingDescriptor map) => map.Properties( descriptor => descriptor .Keyword( propertyDescriptor => propertyDescriptor - .Name(document => document.VCode) + .Name(document => document.VCode) .Normalizer(PubliekZoekenNormalizer)) .Text( propertyDescriptor => propertyDescriptor @@ -104,7 +103,7 @@ public static IPromise Get(PropertiesDescriptor propertyDescriptor - .Name(document => document.Postcode) + .Name(document => document.Postcode) .WithKeyword()) .Text( propertyDescriptor => propertyDescriptor @@ -117,10 +116,11 @@ private static class HoofdactiviteitMapping { public static IPromise Get(PropertiesDescriptor map) => map - .Keyword( + .Text( propertiesDescriptor => propertiesDescriptor - .Name(document => document.Code) - .WithKeyword(PubliekZoekenNormalizer)) + .Name(document => document.Code) + .WithKeyword() + .Analyzer(PubliekZoekenAnalyzer)) .Text( propertiesDescriptor => propertiesDescriptor .Name(document => document.Naam) @@ -134,7 +134,7 @@ public static IPromise Get(PropertiesDescriptor map .Keyword( propertiesDescriptor => propertiesDescriptor - .Name(document => document.Code) + .Name(document => document.Code) .Normalizer(PubliekZoekenNormalizer)) .Text( propertiesDescriptor => propertiesDescriptor @@ -165,7 +165,7 @@ public static IPromise Get(PropertiesDescriptor map .Keyword( propertiesDescriptor => propertiesDescriptor - .Name(document => document.Bron) + .Name(document => document.Bron) .Normalizer(PubliekZoekenNormalizer)) .Text( propertiesDescriptor => propertiesDescriptor