Skip to content

Search view

All information about Infocenter search view you could find here.

Search with view sample

Create view

POST https://api.discover.swiss/info/v2/search/views
{
  "name": "Family activities",
  "scheduleStrategy": "Every12Hours",
  "searchRequest": {
    "project": [
      "demo-web"
    ],
    "combinedTypeTree": [
      "Thing|Place|Tour",
      "Thing|Place|LocalBusiness"
    ],
    "category": [
      "sui_0101",
      "sui_0102"
    ],
    "facets": [
      {
        "Name": "type"
      },
      {
        "Name": "categoryTree"
      }
    ]
  }
}
{
  "id": "ds-f7c2599",
  "name": "Family activities",
  "scheduleStrategy": "Every12Hours",
  "searchRequest": {
    "project": [
      "demo-web"
    ],
    "facets": [
      {
        "name": "type",
        "scope": "current"
      },
      {
        "name": "categoryTree",
        "scope": "current"
      }
    ],
    "category": [
      "sui_0101",
      "sui_0102"
    ],
    "combinedTypeTree": [
      "Thing|Place|Tour",
      "Thing|Place|LocalBusiness"
    ]
  }
}

Use view in search request

Only viewId

POST https://api.discover.swiss/info/v2/search
{
  "resultsPerPage": 10,
  "select": "identifier",
  "viewId": "ds-f7c2599"
}
{
  "count": 305,
  "values": [
    {
      "identifier": "tou_4kq_dbgaaae"
    },
    {
      "identifier": "tou_4kq_dbfjjab"
    },
    {
      "identifier": "tou_y2n-w7v_bcjef-94k7"
    },
    {
      "identifier": "tou_4kq_ciccebid"
    },
    {
      "identifier": "loc_px9-s28_cafe"
    },
    {
      "identifier": "loc_px9-s28_daag"
    },
    {
      "identifier": "loc_px9-s28_babcceg"
    },
    {
      "identifier": "tou_sx2_lu141q3t-f_u002e_ad"
    },
    {
      "identifier": "tou_sx2_lu141q3t-cj"
    },
    {
      "identifier": "tou_sx2_29r1q3t-cgc"
    }
  ],
  "facets": "Fasets data"
}

With clarifying properties

Info

By clarifying properties we mean all other properties exept viewId, because in this case the filtering will be applied on the saved query in the view. So, you can only refine the result, but not expand it.

POST https://api.discover.swiss/info/v2/search
{
  "resultsPerPage": 10,
  "select": "identifier",
  "viewId": "ds-f7c2599",
  "combinedTypeTree": [
    "Thing|Place|LocalBusiness"
  ]
}
{
  "count": 79,
  "values": [
    {
      "identifier": "loc_px9-s28_cafe"
    },
    {
      "identifier": "loc_px9-s28_daag"
    },
    {
      "identifier": "loc_px9-s28_babcceg"
    },
    {
      "identifier": "log_ut4_cfjjgjc"
    },
    {
      "identifier": "log_ut4_bgigicg"
    },
    {
      "identifier": "log_ut4_cacaeej"
    },
    {
      "identifier": "loc_px9-s28_cgaj"
    },
    {
      "identifier": "log_ut4_ddafijd"
    },
    {
      "identifier": "log_ut4_bgigifi"
    },
    {
      "identifier": "log_ut4_cfjjghh"
    }
  ],
  "facets": "Fasets data"
}