search

Returns all infra objects of some type according to a hierarchical query.

Payload

{
    "object": string,
    "query": query,
    "dry": boolean, # default: false
}

Where:

  • object can be any search object declared in search.yml
  • query is a JSON document which can be deserialized into a [search::SearchAst]. Check out examples below.

Response

The response structure depends on the object.

Query language

The query itself is defined using a language made up of nested JSON arrays. It will be parsed and transformed into a PostgreSQL WHERE statement. The language consist of a single boolean expression of comparison statements in prefix notation. For example, the query ["like", ["name"], "%ari%"] will generate a WHERE statement like WHERE "name" LIKE '%ari%'. For more information on the query language itself, check out examples below.

Available functions

See [search::create_processing_context()].

A few query examples

  • The railway station PNO: ["=", ["trigram"], "pno"]
  • The railway stations with either "Paris" or "Lyon" (or both) in their name: ["or", ["search", ["name"], "Paris"], ["search", ["name"], "Lyon"]]
  • All railway stations with "Paris" in their name but not PNO : ["and", ["search", ["name"], "Paris"], ["not", ["=", ["trigram"], "pno"]]]

See [search::SearchAst] for a more detailed view of the query language.

post/search

Query parameters

pageinteger
page_sizeinteger

Request body

dryboolean

Whether to return the SQL query instead of executing it

Only available in debug builds.

object'track' | 'signal' | 'project' | 'study' | 'scenario' | 'trainschedule' | 'operationalpoint' | 'user' required

Object type for query search

Example request

{
  "object": "operationalpoint",
  "query": [
    "and",
    [
      "like",
      [
        "to_string",
        [
          "infra_id"
        ]
      ],
      2
    ],
    [
      "search",
      [
        "name"
      ],
      "plop"
    ]
  ]
}

Response

The search results

Example response

[
  {
    "margins": {
      "values": [
        "5%",
        "2min/100km"
      ]
    },
    "schedule": [
      {
        "arrival": "PT2H",
        "reference_base_arrival": "PT2H",
        "stop_for": "PT2H"
      }
    ]
  }
]

Changes

Changed in 32 of the 77 revisions of this API.11617121

    • added the optional property items/oneOf[subschema #7: SearchResultItemSearchResultItemTrainSchedule]/oneOf[SearchResultItemTrainSchedule]/schedule/items/can_backtrack to the response with the 200 status

      response-optional-property-added

    This revision also has 6 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

    • removed the optional property items/oneOf[subschema #7: SearchResultItemSearchResultItemTrainSchedule]/oneOf[SearchResultItemTrainSchedule]/schedule/items/can_backtrack from the response with the 200 status

      response-optional-property-removed

    This revision also has 1 change that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

    • added the optional property items/oneOf[subschema #7: SearchResultItemSearchResultItemTrainSchedule]/oneOf[SearchResultItemTrainSchedule]/schedule/items/can_backtrack to the response with the 200 status

      response-optional-property-added

    This revision also has 6 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

    • added subschema #2: OperationalPointReferenceDomestic to the items/oneOf[subschema #7: SearchResultItemSearchResultItemTrainSchedule]/oneOf[SearchResultItemTrainSchedule]/path/items/location/oneOf[subschema #2: PathItemLocationOperationalPointPartReference]/allOf[OperationalPointPartReference]/operational_point response property oneOf list for the response status 200

      response-property-one-of-added

    • removed subschema #2: OperationalPointReferenceTrigram from the items/oneOf[subschema #7: SearchResultItemSearchResultItemTrainSchedule]/oneOf[SearchResultItemTrainSchedule]/path/items/location/oneOf[subschema #2: PathItemLocationOperationalPointPartReference]/allOf[OperationalPointPartReference]/operational_point response property oneOf list for the response status 200

      response-property-one-of-removed

    • added the required property items/oneOf[subschema #2: SearchResultItemSearchResultItemOperationalPoint]/oneOf[SearchResultItemOperationalPoint]/country_code to the response with the 200 status

      response-required-property-added

  • dff80f0a6343211See the full diff
    • added subschema #2: OperationalPointReferenceTrigram to the items/oneOf[subschema #7: SearchResultItemSearchResultItemTrainSchedule]/oneOf[SearchResultItemTrainSchedule]/path/items/location/oneOf[subschema #2: PathItemLocationOperationalPointPartReference]/allOf[OperationalPointPartReference]/operational_point response property oneOf list for the response status 200

      response-property-one-of-added

    • removed the required property items/oneOf[subschema #2: SearchResultItemSearchResultItemOperationalPoint]/oneOf[SearchResultItemOperationalPoint]/country_code from the response with the 200 status

      response-required-property-removed

    • removed the optional property items/oneOf[subschema #7: SearchResultItemSearchResultItemTrainSchedule]/oneOf[SearchResultItemTrainSchedule]/schedule/items/can_backtrack from the response with the 200 status

      response-optional-property-removed

    • removed subschema #2: OperationalPointReferenceDomestic from the items/oneOf[subschema #7: SearchResultItemSearchResultItemTrainSchedule]/oneOf[SearchResultItemTrainSchedule]/path/items/location/oneOf[subschema #2: PathItemLocationOperationalPointPartReference]/allOf[OperationalPointPartReference]/operational_point response property oneOf list for the response status 200

      response-property-one-of-removed

    This revision also has 12 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

  • 32ca346a5add13See the full diff
    • added subschema #2: OperationalPointReferenceDomestic to the items/oneOf[subschema #7: SearchResultItemSearchResultItemTrainSchedule]/oneOf[SearchResultItemTrainSchedule]/path/items/location/oneOf[subschema #2: PathItemLocationOperationalPointPartReference]/allOf[OperationalPointPartReference]/operational_point response property oneOf list for the response status 200

      response-property-one-of-added

    • added the optional property items/oneOf[subschema #7: SearchResultItemSearchResultItemTrainSchedule]/oneOf[SearchResultItemTrainSchedule]/schedule/items/can_backtrack to the response with the 200 status

      response-optional-property-added

    • removed subschema #2: OperationalPointReferenceTrigram from the items/oneOf[subschema #7: SearchResultItemSearchResultItemTrainSchedule]/oneOf[SearchResultItemTrainSchedule]/path/items/location/oneOf[subschema #2: PathItemLocationOperationalPointPartReference]/allOf[OperationalPointPartReference]/operational_point response property oneOf list for the response status 200

      response-property-one-of-removed

    • added the required property items/oneOf[subschema #2: SearchResultItemSearchResultItemOperationalPoint]/oneOf[SearchResultItemOperationalPoint]/country_code to the response with the 200 status

      response-required-property-added

    This revision also has 6 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

  • 62dbae65a59321See the full diff
    • added subschema #2: OperationalPointReferenceTrigram to the items/oneOf[subschema #7: SearchResultItemSearchResultItemTrainSchedule]/oneOf[SearchResultItemTrainSchedule]/path/items/location/oneOf[subschema #2: PathItemLocationOperationalPointPartReference]/allOf[OperationalPointPartReference]/operational_point response property oneOf list for the response status 200

      response-property-one-of-added

    • removed the required property items/oneOf[subschema #2: SearchResultItemSearchResultItemOperationalPoint]/oneOf[SearchResultItemOperationalPoint]/country_code from the response with the 200 status

      response-required-property-removed

    • removed subschema #2: OperationalPointReferenceDomestic from the items/oneOf[subschema #7: SearchResultItemSearchResultItemTrainSchedule]/oneOf[SearchResultItemTrainSchedule]/path/items/location/oneOf[subschema #2: PathItemLocationOperationalPointPartReference]/allOf[OperationalPointPartReference]/operational_point response property oneOf list for the response status 200

      response-property-one-of-removed

    This revision also has 4 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

  • fa2c0899ac3612See the full diff
    • added subschema #2: OperationalPointReferenceDomestic to the items/oneOf[subschema #7: SearchResultItemSearchResultItemTrainSchedule]/oneOf[SearchResultItemTrainSchedule]/path/items/location/oneOf[subschema #2: PathItemLocationOperationalPointPartReference]/allOf[OperationalPointPartReference]/operational_point response property oneOf list for the response status 200

      response-property-one-of-added

    • removed subschema #2: OperationalPointReferenceTrigram from the items/oneOf[subschema #7: SearchResultItemSearchResultItemTrainSchedule]/oneOf[SearchResultItemTrainSchedule]/path/items/location/oneOf[subschema #2: PathItemLocationOperationalPointPartReference]/allOf[OperationalPointPartReference]/operational_point response property oneOf list for the response status 200

      response-property-one-of-removed

    • added the required property items/oneOf[subschema #2: SearchResultItemSearchResultItemOperationalPoint]/oneOf[SearchResultItemOperationalPoint]/country_code to the response with the 200 status

      response-required-property-added

    • added the optional property items/oneOf[subschema #7: SearchResultItemSearchResultItemTrainSchedule]/oneOf[SearchResultItemTrainSchedule]/schedule/items/reference_base_arrival to the response with the 200 status

      response-optional-property-added

    • added the optional property items/oneOf[subschema #7: SearchResultItemSearchResultItemTrainSchedule]/oneOf[SearchResultItemTrainSchedule]/schedule/items/reference_position to the response with the 200 status

      response-optional-property-added

    This revision also has 1 change that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

  • 73f0d9b8f23a231See the full diff
    • added subschema #2: OperationalPointReferenceTrigram to the items/oneOf[subschema #7: SearchResultItemSearchResultItemTrainSchedule]/oneOf[SearchResultItemTrainSchedule]/path/items/location/oneOf[subschema #2: PathItemLocationOperationalPointPartReference]/allOf[OperationalPointPartReference]/operational_point response property oneOf list for the response status 200

      response-property-one-of-added

    • removed the required property items/oneOf[subschema #2: SearchResultItemSearchResultItemOperationalPoint]/oneOf[SearchResultItemOperationalPoint]/country_code from the response with the 200 status

      response-required-property-removed

    • removed the optional property items/oneOf[subschema #7: SearchResultItemSearchResultItemTrainSchedule]/oneOf[SearchResultItemTrainSchedule]/schedule/items/can_backtrack from the response with the 200 status

      response-optional-property-removed

    • removed the optional property items/oneOf[subschema #7: SearchResultItemSearchResultItemTrainSchedule]/oneOf[SearchResultItemTrainSchedule]/schedule/items/reference_base_arrival from the response with the 200 status

      response-optional-property-removed

    • removed the optional property items/oneOf[subschema #7: SearchResultItemSearchResultItemTrainSchedule]/oneOf[SearchResultItemTrainSchedule]/schedule/items/reference_position from the response with the 200 status

      response-optional-property-removed

    • removed subschema #2: OperationalPointReferenceDomestic from the items/oneOf[subschema #7: SearchResultItemSearchResultItemTrainSchedule]/oneOf[SearchResultItemTrainSchedule]/path/items/location/oneOf[subschema #2: PathItemLocationOperationalPointPartReference]/allOf[OperationalPointPartReference]/operational_point response property oneOf list for the response status 200

      response-property-one-of-removed

    This revision also has 12 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

Of the 77 revisions, 2 have no diff computed.