Conversation
Set "FeatureManagement:SearchController" to false in the base test config. Tests that require it now explicitly enable the flag by merging it into their config, making feature usage explicit and improving test clarity.
Co-authored-by: Copilot <copilot@github.com>
Refactor SearchController feature flag in Health tests
* Refactor table-related models and tests to replace ContentValues with Metrics
…proxy Feature/search backend proxy
…s, validate origins
…-origins [Feature] Implement CORS configuration with allowed origins support
Bumps the npm_and_yarn group with 1 update in the /.github/skills/openapi-validation directory: [fast-uri](https://github.com/fastify/fast-uri). Updates `fast-uri` from 3.1.0 to 3.1.2 - [Release notes](https://github.com/fastify/fast-uri/releases) - [Commits](fastify/fast-uri@v3.1.0...v3.1.2) --- updated-dependencies: - dependency-name: fast-uri dependency-version: 3.1.2 dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <support@github.com>
…te search logic (#77) * [Feature] Add query fields support for Elasticsearch service and update search logic * [Feature] Refactor ElasticSearchService to use BoostedField records for query fields and update related tests * Update ElasticSearchServiceTests to use AllFieldGroupSample for assertions and improve code coverage justification * [Version] Update project version to 0.5.5
…lisation [Bug] Code filter deserialisation
[Feature] TableSummary "geo" property
…/dot-github/skills/openapi-validation/npm_and_yarn-053c9c4054 Bump fast-uri from 3.1.0 to 3.1.2 in /.github/skills/openapi-validation in the npm_and_yarn group across 1 directory
…-tablesummary Revert geo field from table summary
…t for content types
… for non-ASCII dimension codes
…ging [Feature] Information level logging for controller responses
…-transformer Dimension codes are no longer simplified automatically
…sion [Dependency] Update package references in project files to latest versions
sakari-malkki
approved these changes
Jun 4, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR appears to prepare the 0.5.9 release candidate by updating the public table summary model (content values → metrics), removing legacy code-sanitization utilities, and adding operational/config improvements (CORS + optional Elasticsearch proxy) along with Elasticsearch query-time boosting.
Changes:
- Rename/reshape table summary “content values” into “metrics” (
TableSummary, builder, tests, and related docs). - Improve URL/filter handling by removing
MetaCodeTools.Convert()and using proper URL encoding for default filter URL generation. - Enhance runtime behavior/config: optional CORS policy via config, optional Elasticsearch proxy, and ES multi_match boosting fields + unit tests.
Reviewed changes
Copilot reviewed 33 out of 34 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| PxApi/Utilities/TableSummaryBuilder.cs | Builds TableSummary using Metrics and includes all non-metric/non-time dimensions. |
| PxApi/Utilities/MetaCodeTools.cs | Removed legacy URL-safe “code conversion” helper. |
| PxApi/Services/Search/ElasticSearchService.cs | Adds boosted ES query fields, refactors field constants, and exposes helper methods for tests. |
| PxApi/PxApi.csproj | Bumps app version to 0.5.9 and updates package versions. |
| PxApi/Program.cs | Adds optional CORS setup and optional Elasticsearch proxy configuration. |
| PxApi/Models/TableSummary.cs | Renames ContentValues → Metrics and updates documentation. |
| PxApi/Models/QueryFilters/MetaFiltering.cs | Stops using code conversion; URL-encodes default filter query string. |
| PxApi/Models/QueryFilters/FilterJsonConverter.cs | Tightens deserialization behavior/errors; expands allowed characters; uses JsonException. |
| PxApi/Models/MetricInfo.cs | Renames model class from ContentValueInfo to MetricInfo. |
| PxApi/ModelBuilders/JsonStat2Builder.cs | Uses raw dimension codes (no conversion) for JSON-stat IDs/keys/roles. |
| PxApi/Controllers/TablesController.cs | Adds informational logging for returned table summaries. |
| PxApi/Controllers/MetadataController.cs | Adds informational logging after building metadata response. |
| PxApi/Controllers/DataController.cs | Centralizes media-type strings into constants; logs response format + cell count. |
| PxApi/Controllers/DatabasesController.cs | Adds ILogger and logs database listing result count. |
| PxApi/Configuration/SearchConfig.cs | Adds optional ProxyAddress for Elasticsearch connectivity. |
| PxApi/Configuration/CorsConfig.cs | New config type validating allowed CORS origins. |
| PxApi/Configuration/AppSettings.cs | Wires up new Cors configuration section. |
| PxApi/appsettings.Template.json | Adds Search:ProxyAddress and Cors:AllowedOrigins template entries. |
| PxApi.UnitTests/Utils/TestConfigFactory.cs | Disables SearchController by default in base test config. |
| PxApi.UnitTests/UtilitiesTests/TableSummaryBuilderTests.cs | Updates tests for Metrics and adds geo-dimension coverage. |
| PxApi.UnitTests/Services/ElasticSearchServiceTests.cs | Adds unit tests for GetFields/GetQueryFields and boosting behavior. |
| PxApi.UnitTests/PxApi.UnitTests.csproj | Updates test package versions and Px.Utils version. |
| PxApi.UnitTests/Models/Search/SearchResultItemTests.cs | Updates summary construction to use Metrics/MetricInfo. |
| PxApi.UnitTests/Models/QueryFilters/MetaFilteringTests.cs | Updates expectations for URL encoding + adds non-ASCII encoding tests. |
| PxApi.UnitTests/Models/QueryFilters/FilterJsonConverterTests.cs | Updates exception expectations; adds allowed-char + unknown-type coverage. |
| PxApi.UnitTests/ControllerTests/TablesControllerTests.cs | Updates assertions to use Metrics. |
| PxApi.UnitTests/ControllerTests/SearchControllerTests.cs | Updates assertions to use Metrics. |
| PxApi.UnitTests/ControllerTests/HealthControllerTests.cs | Ensures SearchController feature is enabled explicitly for relevant tests. |
| PxApi.UnitTests/ControllerTests/DataControllerStreamTests.cs | Updates expected dimension keys/filters to use raw (non-converted) dimension codes. |
| PxApi.UnitTests/ControllerTests/DatabasesControllerTests.cs | Updates controller construction to include ILogger. |
| PxApi.UnitTests/ConfigurationTests/CorsConfigTests.cs | Adds coverage for CORS origin parsing/validation behavior. |
| docs/architecture/services-and-utilities.md | Updates TableSummaryBuilder description (geo dims included). |
| docs/architecture/models-and-builders.md | Updates TableSummary bullet but still needs alignment for MetricInfo (see comment). |
| .github/skills/openapi-validation/package-lock.json | Bumps fast-uri dependency version. |
Files not reviewed (1)
- .github/skills/openapi-validation/package-lock.json: Language not supported
Comment on lines
+19
to
20
| - **`TableSummary`** (`TableSummary.cs`): Rich table metadata summary including dimensions (including any geographical dimensions), content values, time ranges, and links. Built by `TableSummaryBuilder`. | ||
| - **`ContentValueInfo`** (`ContentValueInfo.cs`): Information about a content/measure value in a table. |
Comment on lines
+30
to
31
| [ExcludeFromCodeCoverage(Justification = "SDK-dependent members are tested indirectly; pure helpers are covered by unit tests.")] | ||
| public class ElasticSearchService(ElasticsearchClient client, SearchConfig searchConfig, ILogger<ElasticSearchService> logger) : ISearchService |
Comment on lines
+280
to
+283
| if (!string.IsNullOrWhiteSpace(searchConfig.ProxyAddress)) | ||
| { | ||
| esSettings = esSettings.Proxy(new Uri(searchConfig.ProxyAddress)); | ||
| } |
Comment on lines
23
to
28
| /// <summary> | ||
| /// Content dimension value names and their units of measurement. | ||
| /// Metric names and their units of measurement. | ||
| /// </summary> | ||
| [Required] | ||
| public required List<ContentValueInfo> ContentValues { get; set; } | ||
| public required List<MetricInfo> Metrics { get; set; } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.