Refactor system search cache handling and update OpenAPI specifications for max results

This commit is contained in:
Jeppe Bundgaard
2026-07-07 18:59:07 +02:00
parent 084435e9b8
commit 10d1eb5bac
18 changed files with 915 additions and 2054 deletions
+22 -74
View File
@@ -10758,7 +10758,7 @@ paths:
tags:
- Search
summary: System-wide search
description: Search across all supported entities with permission-aware filtering and optional intent parsing debug metadata. Customer records and customer-related entities are matched against a local e-conomic customer index (name/address/email/CVR) that is refreshed by cron. Intent parsing is invoked adaptively when lexical confidence is low or when the query looks intent-driven. Results are ordered by relevance, with recent records preferred when relevance is comparable.
description: Search across supported entities with permission-aware filtering, strict relevance filtering, and a single capped result set. Customer records and customer-related entities are matched against a local e-conomic customer index (name/address/email/CVR) that is refreshed by cron. Results are ordered by relevance, with recent records preferred when relevance is comparable.
operationId: systemWideSearchGet
parameters:
- in: query
@@ -10766,7 +10766,7 @@ paths:
required: true
schema:
type: string
description: Free-text query to search for. Supports natural-language intent fallback and domain synonyms such as `rabat` -> `discount`.
description: Free-text query to search for. Supports deterministic domain synonyms such as `rabat` -> `discount`.
- in: query
name: include_types
required: false
@@ -10795,27 +10795,14 @@ paths:
default: true
description: Include associated objects when matching a primary entity such as a customer.
- in: query
name: debug_intent
required: false
schema:
type: boolean
default: false
description: Include intent parser diagnostics in `meta.intent_parser`.
- in: query
name: limit
name: max_results
required: false
schema:
type: integer
minimum: 1
maximum: 200
maximum: 50
default: 50
- in: query
name: offset
required: false
schema:
type: integer
minimum: 0
default: 0
description: Maximum number of relevance-ranked results to return. Values above 50 are capped to 50.
responses:
'200':
description: Search results returned successfully
@@ -10833,7 +10820,7 @@ paths:
tags:
- Search
summary: System-wide search
description: Search across all supported entities using JSON request payload. Customer-related matches include local e-conomic customer index fields. Intent parsing may run adaptively for intent-driven natural-language queries. Results are ordered by relevance, with recent records preferred when relevance is comparable.
description: Search across supported entities using JSON request payload. Customer-related matches include local e-conomic customer index fields. Results use strict relevance filtering and are ordered by relevance, with recent records preferred when relevance is comparable.
operationId: systemWideSearchPost
requestBody:
required: true
@@ -10860,7 +10847,7 @@ paths:
tags:
- Search
summary: Clear system search caches
description: Clears both query-result cache and intent-parser cache namespaces for system-wide search.
description: Clears query-result caches for system-wide search.
operationId: clearSystemSearchCache
responses:
'200':
@@ -10879,7 +10866,7 @@ paths:
tags:
- Search
summary: Queue system search cache rebuild
description: Queues a cache rebuild request and clears active query/intent cache namespaces immediately.
description: Queues a document-index rebuild request and clears active query cache entries immediately.
operationId: rebuildSystemSearchCache
requestBody:
required: false
@@ -15321,7 +15308,7 @@ components:
properties:
query:
type: string
description: Free-text query to search for. Customer lookups include local e-conomic index fields and lexical synonym expansion (for example `rabat` -> `discount`).
description: Free-text query to search for. Customer lookups include local e-conomic index fields and deterministic lexical synonym expansion (for example `rabat` -> `discount`).
include_types:
type: array
items:
@@ -15336,19 +15323,12 @@ components:
type: boolean
default: true
description: Include associated records for matched core entities.
debug_intent:
type: boolean
default: false
description: Include parser diagnostics in `meta.intent_parser`.
limit:
max_results:
type: integer
minimum: 1
maximum: 200
maximum: 50
default: 50
offset:
type: integer
minimum: 0
default: 0
description: Maximum number of relevance-ranked results to return. Values above 50 are capped to 50.
SystemSearchResult:
type: object
@@ -15381,50 +15361,17 @@ components:
- title
- score
SystemSearchIntentParserMeta:
type: object
properties:
invoked:
type: boolean
source:
type: string
enum: [cache, openai, none]
status:
type: string
confidence:
type: number
minimum: 0
maximum: 1
expanded_terms:
type: array
items:
type: string
entity_hints:
type: array
items:
$ref: '#/components/schemas/SystemSearchEntityType'
fallback_reason:
type: string
nullable: true
required:
- invoked
- source
- status
- confidence
- expanded_terms
- entity_hints
SystemSearchMeta:
type: object
properties:
query:
type: string
limit:
max_results:
type: integer
offset:
type: integer
total:
returned:
type: integer
truncated:
type: boolean
allowed_types:
type: array
items:
@@ -15435,13 +15382,11 @@ components:
hit:
type: boolean
required: [hit]
intent_parser:
$ref: '#/components/schemas/SystemSearchIntentParserMeta'
required:
- query
- limit
- offset
- total
- max_results
- returned
- truncated
- allowed_types
- cache
@@ -16527,6 +16472,9 @@ components:
group_id:
type: integer
description: User group/role ID
limited_backoffice_managed:
type: boolean
description: Whether the user is managed through limited backoffice and has locked raw role/customer edits
phone_country_code:
type: integer
description: Phone country code