{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "search-result.schema.json", "title": "SearchResult", "description": "One page of GET /v1/search (R3, backend of APP-04): a contextual search over the ACTIVE retrieval generation (INF-11), under the analyst capability. Phase and purpose come from the capability; time (as_of) and rights purposes are applied before any ranking; before the lock a query for the Call or the machines' numbers is withheld and items that name them or that a machine produced are never shown (counted in withheld_before_lock). Counter-evidence is mandatory when it exists: the first page carries the opposite polarity to the dominant one, marked role counter_evidence; none_available says no item of that side passed the filters, not_applicable that no item has a side or that the page is not the first (the counter-evidence of a result set is reported on its first page). Pages are cut by an opaque cursor bound to the generation (a cursor of another generation is refused with 409). Each item lists the claims of the bitemporal graph that cite it as of the cut. Evidence ids are the motor's own ids (they may carry underscores).", "type": "object", "additionalProperties": false, "required": ["schema_version", "request_id", "question_id", "phase", "as_of", "environment", "status", "reason", "query", "generation", "filters", "items", "counter_evidence", "withheld_before_lock", "degradations", "page"], "properties": { "schema_version": { "$ref": "common.schema.json#/$defs/schema_version" }, "request_id": { "$ref": "common.schema.json#/$defs/id" }, "question_id": { "$ref": "common.schema.json#/$defs/question_id" }, "phase": { "$ref": "common.schema.json#/$defs/phase" }, "as_of": { "$ref": "common.schema.json#/$defs/utc" }, "environment": { "$ref": "common.schema.json#/$defs/environment" }, "status": { "enum": ["ok", "empty", "withheld"] }, "reason": { "description": "Why a page has no items: nothing passed the filters, nothing matched, or the pre-lock refusal. null when there are items.", "enum": ["nothing_available", "no_match", "reserved_before_lock", null] }, "query": { "type": "object", "additionalProperties": false, "required": ["text", "context"], "properties": { "text": { "type": "string", "maxLength": 500 }, "context": { "type": ["object", "null"], "additionalProperties": false, "required": ["kind", "id", "title"], "properties": { "kind": { "enum": ["question", "book", "part"] }, "id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]{0,127}$" }, "title": { "type": "string", "maxLength": 300 } } } } }, "generation": { "type": "object", "additionalProperties": false, "required": ["generation_id", "content_hash", "snapshot_id", "encoder_generation_id", "dense"], "properties": { "generation_id": { "type": "string", "pattern": "^gen-[0-9a-f]{16}$" }, "content_hash": { "$ref": "common.schema.json#/$defs/sha256" }, "snapshot_id": { "$ref": "common.schema.json#/$defs/id" }, "encoder_generation_id": { "type": "string", "minLength": 1, "maxLength": 200 }, "dense": { "type": "boolean", "description": "false when the query encoder is not the generation's: the page is lexical only and degradations say why." } } }, "filters": { "type": "object", "additionalProperties": false, "required": ["required_purposes", "considered", "kept", "rejected_time", "rejected_rights", "rejected_invalid"], "properties": { "required_purposes": { "type": "array", "uniqueItems": true, "minItems": 1, "items": { "enum": ["read", "process", "external_provider", "publish"] } }, "considered": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "kept": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "rejected_time": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "rejected_rights": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "rejected_invalid": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } } }, "items": { "type": "array", "maxItems": 50, "items": { "$ref": "#/$defs/item" } }, "counter_evidence": { "type": "object", "additionalProperties": false, "required": ["status", "evidence_ids"], "properties": { "status": { "enum": ["present", "none_available", "not_applicable"] }, "evidence_ids": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/evidence_id" } } } }, "withheld_before_lock": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "degradations": { "type": "array", "items": { "type": "object", "additionalProperties": false, "required": ["code", "detail"], "properties": { "code": { "type": "string", "pattern": "^[a-z][a-z0-9_]{0,63}$" }, "detail": { "type": "string", "maxLength": 300 } } } }, "page": { "type": "object", "additionalProperties": false, "required": ["size", "offset", "returned", "next_cursor"], "properties": { "size": { "type": "integer", "minimum": 1, "maximum": 50 }, "offset": { "type": "integer", "minimum": 0, "maximum": 200 }, "returned": { "type": "integer", "minimum": 0, "maximum": 50 }, "next_cursor": { "type": ["string", "null"], "pattern": "^[A-Za-z0-9_-]{1,512}$" } } } }, "$defs": { "evidence_id": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$" }, "clock": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}(T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,6})?(Z|\\+00:00))?$" }, "optional_clock": { "type": ["string", "null"], "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}(T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,6})?(Z|\\+00:00))?$" }, "item": { "type": "object", "additionalProperties": false, "required": ["evidence_id", "source_id", "source_url", "span", "clocks", "rights_purposes", "polarity", "lang", "rank", "score", "role", "reasons", "graph"], "properties": { "evidence_id": { "$ref": "#/$defs/evidence_id" }, "source_id": { "$ref": "#/$defs/evidence_id" }, "source_url": { "$ref": "common.schema.json#/$defs/https_url" }, "span": { "type": "string", "minLength": 1, "maxLength": 600 }, "clocks": { "type": "object", "additionalProperties": false, "required": ["available_at", "published_at", "captured_at"], "properties": { "available_at": { "$ref": "#/$defs/clock" }, "published_at": { "$ref": "#/$defs/optional_clock" }, "captured_at": { "$ref": "#/$defs/optional_clock" } } }, "rights_purposes": { "type": "array", "uniqueItems": true, "items": { "enum": ["read", "process", "external_provider", "train", "retain", "publish"] } }, "polarity": { "enum": ["bull", "bear", "neutral", null] }, "lang": { "type": ["string", "null"], "pattern": "^[a-z]{2}$" }, "rank": { "type": "integer", "minimum": 1, "maximum": 250 }, "score": { "type": "number" }, "role": { "enum": ["match", "counter_evidence"] }, "reasons": { "type": "array", "items": { "type": "string", "maxLength": 64 } }, "graph": { "description": "Claims of the bitemporal graph that cite this item, as of the cut (at most 10).", "type": "array", "maxItems": 10, "items": { "type": "object", "additionalProperties": false, "required": ["claim_id", "status", "relation_kind"], "properties": { "claim_id": { "type": "string", "pattern": "^clm_[a-z0-9_-]{2,80}$" }, "status": { "enum": ["current", "superseded", "refuted"] }, "relation_kind": { "enum": ["observed", "attributed_causal", "inferred_hypothesis", null] } } } } } } } }