Fuzzy search text query across searchable attributes using trigram similarity with dynamic threshold. Searchable attributes: - Order identifiers (indexed): accountOrderNumber, id, zonosOrderId, references.zonosOrderNumber - Payment IDs (indexed): paymentIntentId, paymentChargeId - Currency: currencyCode (indexed) - Tracking numbers: trackingNumbers (array, indexed) - Destination party (indexed, denormalized): * destination.person.name, destination.person.phone, destination.person.email, destination.location.locality, destination.location.postalCode, destination.location.administrativeArea, destination.location.administrativeAreaCode (stored as concatenated searchable text field) * destination.location.countryCode (stored as separate indexed column for better precision on short codes) - Service level (indexed, denormalized): serviceLevelCode, serviceLevelDisplayName - Party IDs (JSONB): party IDs stored in parties array - Shipment rating IDs (JSONB): shipment rating IDs stored in shipment_ratings array - Landed costs (JSONB): landedCostId, landedCostShortId (extracted from landed_costs array) - Amount fields: amount (total calculated), amountDetails.amount, amountDetails.currencyCode Note: Destination party and service level data are stored as denormalized columns on the order table when the order is created, enabling efficient fuzzy search without requiring federation joins. Similarity threshold is dynamic based on search text length: - 2 characters or less: 0.1 threshold (for country codes, short IDs) - 3-4 characters: 0.1 to 0.8 (linear interpolation) - 5+ characters: 0.8 threshold (for precise matching of longer strings) Results are ordered by similarity score (best matches first).
Input.
OrderSearchFilter
No description
Fields
createdAt
OrderDateFilter
currencyCode
CurrencyCode
destinationCountryCode
String
orderType
OrderType
organizationId
String
paymentChargeId
String
paymentIntentId
String
q
String
serviceLevels
[String!]
ServiceLevelcodes or names that are used for an Orderstatus
OrderStatus
totalAmount
OrderAmountFilter
trackingNumbers
[String!]