GenericSearch API: Previous versions

更新时间:
复制 MD 格式

This topic describes how to call the standard GenericSearch API using the Alibaba Cloud OpenAPI SDK and details its request parameters.

Important

Use the new Web Search (Document Search) API. It supports new features such as tiered billing, an enhanced edition, and summaries.

Authorization information

The following table describes the authorization information for this API. You can use this information in the Action element of a Resource Access Management (RAM) access policy statement to grant a RAM user or RAM role permission to call this API. The following list describes the columns in the table:

  • Operation: The specific permission.

  • Access level: The access level of each operation. Valid values are Write, Read, and List.

  • Resource type: The resource type that the operation supports for authorization. The following list describes the details:

  • An asterisk (*) precedes a required resource type.

  • For operations that do not support resource-level authorization, use All resources.

  • Condition key: The condition key defined by the cloud product. This column does not include the basic elements of an access policy that apply to all operations.

  • Associated operation: Other permissions required to successfully execute the operation. You must also have permissions for the associated operations.

Operation

Access level

Resource type

Condition key

Associated operation

iqs:GenericSearch

None

All resources

*

None

None

API calls

Request struct

Parameter

Type

Required

Description

Example

query

String

Yes

The search query. The value can be 1 to 500 characters in length. For best results, limit the query to 30 characters.

Apple phone

timeRange

String

No

The time range. Valid values:

  • NoLimit: No limit (default)

  • OneDay: The last 24 hours

  • OneWeek: The last week

  • OneMonth: The last month

  • OneYear: The last year

OneWeek

industry

String

No

The industry-specific search. If you specify this parameter, only search results from industry-specific sites are returned. Separate multiple industries with commas. Valid values:

  • finance: finance

  • law: Law

  • medical: Medical

  • internet: The Internet (curated)

  • Tax

  • news_province: Provincial news

  • news_center: Central news

page

Int32

No

The page number for pagination. Default value: 1.

returnMainText

Boolean

No

Specifies whether to return the main body of the webpage. Default value: true.

returnRichMainBody

Boolean

No

Specifies whether to return the full main body in rich text format. Default value: false.

returnMarkdownText

Boolean

No

Specifies whether to return the webpage content in Markdown format. Default value: true.

enableRerank

Boolean

No

Specifies whether to enable reranking. Default value: true.

advancedParams

map<string, string>

No

The advanced search parameters:

  • startPublishedDate: The start of the webpage publication date range. The format is YYYY-MM-DD.

  • endPublishedDate: The end of the webpage publication date range. The format is YYYY-MM-DD.

Note

Date-based search has a higher priority than timeRange.

{
  "startPublishedDate": "2025-07-01",
  "endPublishedDate": "2025-07-31"
}
Important
  1. By default, 10 webpages are returned. This value cannot be changed.

  2. If you require low latency, you can disable enableRerank to reduce latency by about 140 ms. If you do not use mainText or markdownText, you can disable returnMainText and returnMarkdownText to reduce network transmission and latency.

Install the SDK

Java SDK

Prerequisites

Java 8 or later is installed.

Maven dependency
<dependency>
    <groupId>com.aliyun</groupId>
    <artifactId>iqs20241111</artifactId>
    <version>1.6.2</version>
</dependency>
Sample code
package com.aliyun.iqs.example;

import com.alibaba.fastjson.JSON;
import com.aliyun.iqs20241111.Client;
import com.aliyun.iqs20241111.models.GenericSearchRequest;
import com.aliyun.iqs20241111.models.GenericSearchResponse;
import com.aliyun.iqs20241111.models.GenericSearchResult;
import com.aliyun.tea.TeaException;
import com.aliyun.teaopenapi.models.Config;


public class GenericSearchMain {

    public static void main(String[] args) throws Exception {
        Client client = initClient();
        invoke(client,"Hangzhou food", "NoLimit");
    }

    private static Client initClient() throws Exception {
        // TODO: Replace with your AccessKey ID and AccessKey secret.
        String accessKeyId = "YOUR_ACCESS_KEY";
        String accessKeySecret = "YOUR_ACCESS_SECRET";
        
       // TODO: Or, load from environment variables (recommended).
       // String accessKeyId = System.getenv("ACCESS_KEY");
       // String accessKeySecret = System.getenv("ACCESS_SECRET");
        Config config = new Config()
                .setAccessKeyId(accessKeyId)
                .setAccessKeySecret(accessKeySecret);
        config.setEndpoint("iqs.cn-zhangjiakou.aliyuncs.com");
        return new Client(config);
    }

    private static void invoke(Client client, String query, String timeRange)  {
        GenericSearchRequest request = new GenericSearchRequest();
        request.setQuery(query);
        request.setTimeRange(timeRange);
        try {
            GenericSearchResponse response = client.genericSearch(request);
            GenericSearchResult result = response.getBody();
            System.out.println(JSON.toJSONString(result));
        } catch (TeaException e) {
            e.printStackTrace();
            System.out.println(e.getMessage());
        }catch (Exception e) {
            e.printStackTrace();
            System.out.println(e.getMessage());
        }
    }
}

Python SDK

Prerequisites

Python 3.8 or later is installed.

Install the SDK
pip3 install alibabacloud_iqs20241111==1.6.2
Sample code
  • Synchronous call

import os

from alibabacloud_iqs20241111 import models
from alibabacloud_iqs20241111.client import Client
from alibabacloud_tea_openapi import models as open_api_models
from Tea.exceptions import TeaException


class Sample:
    def __init__(self):
        pass

    @staticmethod
    def create_client() -> Client:
        config = open_api_models.Config(
            # TODO: Replace with your AccessKey ID and AccessKey secret.
            access_key_id='YOUR_ACCESS_KEY',
            access_key_secret='YOUR_ACCESS_SECRET'     
            # TODO: Or, load from environment variables (recommended).
            # access_key_id=os.environ.get('ACCESS_KEY'),
            # access_key_secret=os.environ.get('ACCESS_SECRET')

        )
        config.endpoint = f'iqs.cn-zhangjiakou.aliyuncs.com'
        return Client(config)

    @staticmethod
    def main() -> None:
        client = Sample.create_client()
        advancedParams = {
            "startPublishedDate": "2025-10-01",
            "endPublishedDate": "2025-10-10"
        }
        run_instances_request = models.GenericSearchRequest(
            query='China GDP',
            advanced_params=advancedParams
        )
        try:
            response = client.generic_search(run_instances_request)
            print(f"API call successful. requestId: {response.body.request_id}, size: {len(response.body.page_items)}")
        except TeaException as e:
            code = e.code
            request_id = e.data.get("requestId")
            message = e.data.get("message")
            print(f"API call failed. requestId: {request_id}, code: {code}, message: {message}")

if __name__ == '__main__':
    Sample.main()
  • Asynchronous call

import asyncio
import datetime
import time
import os

from alibabacloud_iqs20241111 import models
from alibabacloud_iqs20241111.client import Client
from alibabacloud_tea_openapi import models as open_api_models
from Tea.exceptions import TeaException


class Sample:
    def __init__(self):
        pass

    @staticmethod
    def create_client() -> Client:
        config = open_api_models.Config(
            # TODO: Replace with your AccessKey ID and AccessKey secret (loading from environment variables is recommended).
            access_key_id=os.environ.get('ACCESS_KEY'),
            access_key_secret=os.environ.get('ACCESS_SECRET')

        )
        config.endpoint = f'iqs.cn-zhangjiakou.aliyuncs.com'
        return Client(config)

    @staticmethod
    async def main_async() -> None:
        start = time.time()
        client = Sample.create_client()
        run_instances_request = models.GenericSearchRequest(
            query='Hangzhou food',
            time_range="OneYear"
        )
        try:
            # Use an asynchronous method call.
            response = await client.generic_search_async(run_instances_request)
            print(
                f"API call successful. Client cost: {int((time.time() - start) * 1000)}, Server cost: {response.body.search_information.search_time}, requestId: {response.body.request_id}, size: {len(response.body.page_items)}")
        except TeaException as e:
            print(f"API call failed. {e}")

if __name__ == '__main__':
    asyncio.run(Sample.main_async())

Go SDK

Prerequisites

Go 1.10.x or later is installed.

Install the SDK
require (
  github.com/alibabacloud-go/iqs-20241111 v1.6.2
  github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.10
)
Sample code
package main

import (
	"fmt"
	"log"
	"os"

	openapi "github.com/alibabacloud-go/darabonba-openapi/v2/client"
	iqs20241111 "github.com/alibabacloud-go/iqs-20241111/client"
	util "github.com/alibabacloud-go/tea-utils/v2/service"
	"github.com/alibabacloud-go/tea/tea"
)

const endpointURL = "iqs.cn-zhangjiakou.aliyuncs.com"

func createClient() (*iqs20241111.Client, error) {
        // TODO: Replace with your AccessKey ID and AccessKey secret.
        accessKeyID := "YOUR_ACCESS_KEY"
	accessKeySecret := "YOUR_ACCESS_SECRET"
        // TODO: Or, load from environment variables (recommended).
	//accessKeyID := os.Getenv("ACCESS_KEY")
	//accessKeySecret := os.Getenv("ACCESS_SECRET")

	if accessKeyID == "" || accessKeySecret == "" {
		return nil, fmt.Errorf("ACCESS_KEY or ACCESS_SECRET environment variable is not set")
	}

	config := &openapi.Config{
		AccessKeyId:     tea.String(accessKeyID),
		AccessKeySecret: tea.String(accessKeySecret),
		Endpoint:        tea.String(endpointURL),
	}

	return iqs20241111.NewClient(config)
}

func runGenericSearch(client *iqs20241111.Client) error {
	request := &iqs20241111.GenericSearchRequest{
		Query:     tea.String("Hangzhou food"),
		TimeRange: tea.String("NoLimit"),
	}
	runtime := &util.RuntimeOptions{}

	resp, err := client.GenericSearchWithOptions(request, nil, runtime)
	if err != nil {
		return fmt.Errorf("generic search failed: %w", err)
	}

	fmt.Printf("[%s] response: %s\n", *resp.Body.RequestId, resp.Body)
	return nil
}

func main() {
	client, err := createClient()
	if err != nil {
		log.Fatalf("Failed to create client: %v", err)
	}

	if err := runGenericSearch(client); err != nil {
		log.Fatalf("Error running generic search: %v", err)
	}
}

C++ SDK

Prerequisites
  1. A C++11 environment is required, such as Visual Studio 2015 or later on Windows, or GCC 4.9 or later on Linux.

  2. CMake 3.0 or later.

Installation
  1. Download the core library code: git clone https://github.com/aliyun/aliyun-openapi-cpp-sdk.git

  2. Replace the content of /aliyun-openapi-cpp-sdk/core/src/CommonClient.cc with the following code.

/*
 * Copyright 1999-2019 Alibaba Cloud All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <algorithm>
#include <alibabacloud/core/AlibabaCloud.h>
#include <alibabacloud/core/CommonClient.h>
#include <alibabacloud/core/SimpleCredentialsProvider.h>
#include <alibabacloud/core/location/LocationClient.h>
#include <ctime>
#include <iomanip>
#include <sstream>

#include <alibabacloud/core/Utils.h>

namespace AlibabaCloud {

namespace {
const std::string SERVICE_NAME = "Common";
}

CommonClient::CommonClient(const Credentials &credentials,
                           const ClientConfiguration &configuration)
    : CoreClient(SERVICE_NAME, configuration),
      credentialsProvider_(
          std::make_shared<SimpleCredentialsProvider>(credentials)),
      signer_(std::make_shared<HmacSha1Signer>()) {}

CommonClient::CommonClient(
    const std::shared_ptr<CredentialsProvider> &credentialsProvider,
    const ClientConfiguration &configuration)
    : CoreClient(SERVICE_NAME, configuration),
      credentialsProvider_(credentialsProvider),
      signer_(std::make_shared<HmacSha1Signer>()) {}

CommonClient::CommonClient(const std::string &accessKeyId,
                           const std::string &accessKeySecret,
                           const ClientConfiguration &configuration)
    : CoreClient(SERVICE_NAME, configuration),
      credentialsProvider_(std::make_shared<SimpleCredentialsProvider>(
          accessKeyId, accessKeySecret)),
      signer_(std::make_shared<HmacSha1Signer>()) {}

CommonClient::~CommonClient() {}

CommonClient::JsonOutcome
CommonClient::makeRequest(const std::string &endpoint, const CommonRequest &msg,
                          HttpRequest::Method method) const {
  auto outcome = AttemptRequest(endpoint, msg, method);
  if (outcome.isSuccess())
    return JsonOutcome(
        std::string(outcome.result().body(), outcome.result().bodySize()));
  else
    return JsonOutcome(outcome.error());
}

CommonClient::CommonResponseOutcome
CommonClient::commonResponse(const CommonRequest &request) const {
  auto outcome = makeRequest(request.domain(), request, request.httpMethod());
  if (outcome.isSuccess())
    return CommonResponseOutcome(CommonResponse(outcome.result()));
  else
    return CommonResponseOutcome(Error(outcome.error()));
}

void CommonClient::commonResponseAsync(
    const CommonRequest &request, const CommonResponseAsyncHandler &handler,
    const std::shared_ptr<const AsyncCallerContext> &context) const {
  auto fn = [this, request, handler, context]() {
    handler(this, request, commonResponse(request), context);
  };

  asyncExecute(new Runnable(fn));
}

CommonClient::CommonResponseOutcomeCallable
CommonClient::commonResponseCallable(const CommonRequest &request) const {
  auto task = std::make_shared<std::packaged_task<CommonResponseOutcome()>>(
      [this, request]() { return this->commonResponse(request); });

  asyncExecute(new Runnable([task]() { (*task)(); }));
  return task->get_future();
}

HttpRequest CommonClient::buildHttpRequest(const std::string &endpoint,
                                           const ServiceRequest &msg,
                                           HttpRequest::Method method) const {
  return buildHttpRequest(endpoint, dynamic_cast<const CommonRequest &>(msg),
                          method);
}

HttpRequest CommonClient::buildHttpRequest(const std::string &endpoint,
                                           const CommonRequest &msg,
                                           HttpRequest::Method method) const {
  if (msg.requestPattern() == CommonRequest::RpcPattern)
    return buildRpcHttpRequest(endpoint, msg, method);
  else
    return buildRoaHttpRequest(endpoint, msg, method);
}

std::string url_encode(const std::string &value) {
    std::ostringstream escaped;
    escaped.fill('0');
    escaped << std::hex;
    
    for (char c : value) {
        if (isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~') {
            escaped << c;
        } else {
            escaped << '%' << std::setw(2) << int((unsigned char) c);
        }
    }
    
    return escaped.str();
}

HttpRequest
CommonClient::buildRoaHttpRequest(const std::string &endpoint,
                                  const CommonRequest &msg,
                                  HttpRequest::Method method) const {
  const Credentials credentials = credentialsProvider_->getCredentials();

  Url url;
  if (msg.scheme().empty()) {
    url.setScheme("https");
  } else {
    url.setScheme(msg.scheme());
  }
  url.setHost(endpoint);
  url.setPath(msg.resourcePath());

  auto params = msg.queryParameters();
  std::map<std::string, std::string> queryParams;
  for (const auto &p : params) {
    if (!p.second.empty())
      queryParams[p.first] = p.second;
  }

  if (!queryParams.empty()) {
    std::stringstream queryString;
    for (const auto &p : queryParams) {
      if (p.second.empty())
        queryString << "&" << p.first;
      else
        queryString << "&" << p.first << "=" << url_encode(p.second);
    }
    url.setQuery(queryString.str().substr(1));
  }

  HttpRequest request(url);
  request.setMethod(method);

  if (msg.connectTimeout() != kInvalidTimeout) {
    request.setConnectTimeout(msg.connectTimeout());
  } else {
    request.setConnectTimeout(configuration().connectTimeout());
  }

  if (msg.readTimeout() != kInvalidTimeout) {
    request.setReadTimeout(msg.readTimeout());
  } else {
    request.setReadTimeout(configuration().readTimeout());
  }

  if (msg.headerParameter("Accept").empty()) {
    request.setHeader("Accept", "application/json");
  } else {
    request.setHeader("Accept", msg.headerParameter("Accept"));
  }

  std::stringstream ss;
  ss << msg.contentSize();
  request.setHeader("Content-Length", ss.str());
  if (msg.headerParameter("Content-Type").empty()) {
    request.setHeader("Content-Type", "application/octet-stream");
  } else {
    request.setHeader("Content-Type", msg.headerParameter("Content-Type"));
  }
  request.setHeader("Content-MD5",
                    ComputeContentMD5(msg.content(), msg.contentSize()));
  request.setBody(msg.content(), msg.contentSize());

  std::time_t t = std::time(nullptr);
  std::stringstream date;
#if defined(__GNUG__) && __GNUC__ < 5
  char tmbuff[26];
  strftime(tmbuff, 26, "%a, %d %b %Y %T", std::gmtime(&t));
  date << tmbuff << " GMT";
#else
  date << std::put_time(std::gmtime(&t), "%a, %d %b %Y %T GMT");
#endif
  request.setHeader("Date", date.str());
  request.setHeader("Host", url.host());
  request.setHeader("x-sdk-client",
                    std::string("CPP/").append(ALIBABACLOUD_VERSION_STR));
  request.setHeader("x-acs-region-id", configuration().regionId());
  if (!credentials.sessionToken().empty())
    request.setHeader("x-acs-security-token", credentials.sessionToken());
  request.setHeader("x-acs-signature-method", signer_->name());
  request.setHeader("x-acs-signature-nonce", GenerateUuid());
  request.setHeader("x-acs-signature-version", signer_->version());
  request.setHeader("x-acs-version", msg.version());

  std::stringstream plaintext;
  plaintext << HttpMethodToString(method) << "\n"
            << request.header("Accept") << "\n"
            << request.header("Content-MD5") << "\n"
            << request.header("Content-Type") << "\n"
            << request.header("Date") << "\n"
            << canonicalizedHeaders(request.headers());
  if (!queryParams.empty()) {
    std::stringstream queryString;
    for (const auto &p : queryParams) {
      if (p.second.empty())
        queryString << "&" << p.first;
      else
        queryString << "&" << p.first << "=" << p.second;
    }
    url.setQuery(queryString.str().substr(1));
  }
  if (!url.hasQuery())
    plaintext << url.path();
  else
    plaintext << url.path() << "?" << url.query();

  std::stringstream sign;
  sign << "acs " << credentials.accessKeyId() << ":"
       << signer_->generate(plaintext.str(), credentials.accessKeySecret());
  request.setHeader("Authorization", sign.str());
  return request;
}

HttpRequest
CommonClient::buildRpcHttpRequest(const std::string &endpoint,
                                  const CommonRequest &msg,
                                  HttpRequest::Method method) const {
  const Credentials credentials = credentialsProvider_->getCredentials();

  Url url;
  if (msg.scheme().empty()) {
    url.setScheme("https");
  } else {
    url.setScheme(msg.scheme());
  }
  url.setHost(endpoint);
  url.setPath(msg.resourcePath());

  auto params = msg.queryParameters();
  std::map<std::string, std::string> queryParams;
  for (const auto &p : params) {
    if (!p.second.empty())
      queryParams[p.first] = p.second;
  }

  queryParams["AccessKeyId"] = credentials.accessKeyId();
  queryParams["Format"] = "JSON";
  queryParams["RegionId"] = configuration().regionId();
  queryParams["SecurityToken"] = credentials.sessionToken();
  queryParams["SignatureMethod"] = signer_->name();
  queryParams["SignatureNonce"] = GenerateUuid();
  queryParams["SignatureVersion"] = signer_->version();
  std::time_t t = std::time(nullptr);
  std::stringstream ss;
#if defined(__GNUG__) && __GNUC__ < 5
  char tmbuff[26];
  strftime(tmbuff, 26, "%FT%TZ", std::gmtime(&t));
  ss << tmbuff;
#else
  ss << std::put_time(std::gmtime(&t), "%FT%TZ");
#endif
  queryParams["Timestamp"] = ss.str();
  queryParams["Version"] = msg.version();

  std::string bodyParamString;
  auto signParams = queryParams;
  auto bodyParams = msg.bodyParameters();
  for (const auto &p : bodyParams) {
    bodyParamString += "&";
    bodyParamString += (p.first + "=" + UrlEncode(p.second));
    signParams[p.first] = p.second;
  }

  std::stringstream plaintext;
  plaintext << HttpMethodToString(method) << "&" << UrlEncode(url.path()) << "&"
            << UrlEncode(canonicalizedQuery(signParams));
  queryParams["Signature"] =
      signer_->generate(plaintext.str(), credentials.accessKeySecret() + "&");

  std::stringstream queryString;
  for (const auto &p : queryParams)
    queryString << "&" << p.first << "=" << UrlEncode(p.second);
  url.setQuery(queryString.str().substr(1));

  HttpRequest request(url);
  if (msg.connectTimeout() != kInvalidTimeout) {
    request.setConnectTimeout(msg.connectTimeout());
  } else {
    request.setConnectTimeout(configuration().connectTimeout());
  }

  if (msg.readTimeout() != kInvalidTimeout) {
    request.setReadTimeout(msg.readTimeout());
  } else {
    request.setReadTimeout(configuration().readTimeout());
  }

  request.setMethod(method);
  request.setHeader("Host", url.host());
  request.setHeader("x-sdk-client",
                    std::string("CPP/").append(ALIBABACLOUD_VERSION_STR));

  if (!bodyParamString.empty()) {
    request.setBody(bodyParamString.c_str() + 1, bodyParamString.size() - 1);
  }
  return request;
}

} // namespace AlibabaCloud
  1. Install dependencies on Linux: You must install the libcurl, libopenssl, libuuid, and libjsoncpp external libraries.

  • To install these packages on Red Hat or Fedora

# use yum
yum install jsoncpp-devel openssl-devel libuuid-devel libcurl-devel

# use dnf
sudo dnf install libcurl-devel openssl-devel libuuid-devel libjsoncpp-devel
  • For Debian or Ubuntu systems

sudo apt-get install libcurl4-openssl-dev libssl-dev uuid-dev libjsoncpp-dev
  1. Compile the core dependency library: In the SDK root directory (aliyun-openapi-cpp-sdk), run `sudo sh easyinstall.sh core`.

Sample code
#include <cstdlib>
#include <iostream>
#include <string>
#include <alibabacloud/core/AlibabaCloud.h>
#include <alibabacloud/core/CommonRequest.h>
#include <alibabacloud/core/CommonClient.h>
#include <alibabacloud/core/CommonResponse.h>

using namespace std;
using namespace AlibabaCloud;

int main(int argc, char** argv)
{
    AlibabaCloud::ClientConfiguration configuration("cn-zhangjiakou");
    // Specify the timeout when you create the client.
    configuration.setConnectTimeout(10000);
    configuration.setReadTimeout(10000);
    AlibabaCloud::Credentials credential("YOUR_AK", "YOUR_SK" );

    AlibabaCloud::CommonClient client(credential, configuration);
    AlibabaCloud::CommonRequest request(AlibabaCloud::CommonRequest::RequestPattern::RoaPattern);
    request.setHttpMethod(AlibabaCloud::HttpRequest::Method::Get);
    request.setDomain("iqs.cn-zhangjiakou.aliyuncs.com");
    request.setVersion("2024-11-11");
    request.setQueryParameter("query", "Black Myth");
    request.setQueryParameter("timeRange", "NoLimit");
    request.setResourcePath("/linked-retrieval/linked-retrieval-entry/v2/linkedRetrieval/commands/genericSearch");
    request.setRequestPattern(AlibabaCloud::CommonRequest::RequestPattern::RoaPattern);

    request.setHeaderParameter("Content-Type", "application/json");
    auto response = client.commonResponse(request);
    if (response.isSuccess()) {
        printf("Request successful.\n");
        printf("Result: %s\n", response.result().payload().c_str());
    }
    else {
        printf("Error: %s\n", response.error().detail().c_str());
    }
    AlibabaCloud::ShutdownSdk();
    return 0;
}

Bash-curl

  • You can call the API over HTTP. This method uses an independent authentication method that is different from AccessKey pairs. To obtain the X-API-Key from the console, see Create and view a credential key.

curl -H 'X-API-Key: <YOUR-TONGXIAO-API-KEY>' -X GET 'https://cloud-iqs.aliyuncs.com/search/genericSearch?query=<Query to search>' 
// As shown in the following example, the query parameter must be URL-encoded.

Example
curl -X GET --location "https://cloud-iqs.aliyuncs.com/search/genericSearch?query=%E6%9D%AD%E5%B7%9E&&timeRange=OneMonth" -H "X-API-Key: <YOUR-TONGXIAO-API-KEY>"

Response struct

Field

Type

Nullable

Description

Example

requestId

string

This field is required.

The request ID. You can provide this ID for troubleshooting.

pageItems[]

cardType

string

This field cannot be empty.

The card type. The following types are supported:

  • structure_web_info: Standard webpage structure. This type accounts for more than 90% of the recall results.

  • baike_sc/baike: Encyclopedia

  • news_uchq: UC News

  • wenda_selected: Q&A pair

structure_web_info

title

string

A value is required.

The website title.

2024 May Day Holiday and Workday Adjustment Schedule (with Holiday Calendar)

htmlTitle

string

A value is required.

The website title in HTML format.

<em>2024 May Day</em> Labor Day <em>Holiday</em> Adjustment <em>Schedule</em> (with Holiday Calendar) - Bendibao

link

string

This field can be left empty.

The website URL. This field may be empty for a small number of search cards.

http://m.sh.bendibao.com/tour/278811.html

displayLink

string

Nullable

The human-readable website URL. This field may be empty for a small number of search cards.

m.sh.bendibao.com

snippet

string

This field is required.

A dynamic summary of the webpage that contains the matched keywords. The format is plain text.

2024 May Day holiday arrangement: The holiday is from May 1 to May 5, for a total of 5 days. April 28 (Sunday) and May 11 (Saturday) are workdays.

htmlSnippet

string

A value is required.

A dynamic summary of the webpage that contains the matched keywords. The maximum length is 250 characters. The format is HTML.

Note

This field can be used as the retrieval context in retrieval-augmented generation (RAG) scenarios. If you need the full text of the webpage, use the mainText parameter.

<em>2024 May Day</em> Labor Day <em>holiday arrangement</em>: The <em>holiday</em> is from May 1 to May 5, for a total of 5 days. April 28 (Sunday) and May 11 (Saturday) are workdays.

publishTime

int64

This value is required.

The publication time in milliseconds. For websites without a publication time, the default value 0 is used.

1714123620000

score

double

This field cannot be empty.

The reranking relevance score. If reranking is disabled, this score is not available.

hostAuthorityScore

double

This can be left empty.

The dynamic authority score. The value ranges from 0 to 2.

Note

This score is calculated based on the relevance to the input query. Websites that are more relevant to the query receive a higher score. For example, a medical website receives a higher score for a medical query.

1.923339

websiteAuthorityScore

int32

Nullable

The static authority score. This score is determined only by the authority of the website itself and is not related to the query. For more information, see Feature: Static authority score.

3

correlationTag

int32

Nullable

The relevance tag:

0: Low relevance

1: Not low relevance

1

mainText

string

Nullable

The main body of the webpage. By default, the first 500 characters are returned. To retrieve a longer text (up to the first 3,000 characters), contact your Alibaba Cloud account manager.

Important

Parsing of the main body is supported for frequently recalled results, such as structure_web_info and news_uchq.

Notice on the Arrangement of Some Holidays\nState Council General Office Official Telegram [2023] No. 7\nTo the people's governments of all provinces, autonomous regions, and municipalities directly under the Central Government, all ministries and commissions of the State Council, and all directly affiliated institutions:\nWith the approval of the State Council, the specific arrangements for the 2024 New Year's Day, Spring Festival, Qingming Festival, Labor Day, Dragon Boat Festival, Mid-Autumn Festival, and National Day holidays and workday adjustments are hereby notified as follows.\nI. New Year's Day: January 1 is a holiday, consecutive with the weekend.\nII. Spring Festival: The holiday is from February 10 to 17, for a total of 8 days. February 4 (Sunday) and February 18 (Sunday) are workdays. All organizations are encouraged to implement systems such as paid annual leave to arrange for employees to rest on New Year's Eve (February 9).\nIII. Qingming Festival: The holiday is from April 4 to 6, for a total of 3 days. April 7 (Sunday) is a workday.\nIV. Labor Day: The holiday is from May 1 to 5, for a total of 5 days. April 28 (Sunday) and May 11 (Saturday) are workdays.\nV. Dragon Boat Festival: June 10 is a holiday, consecutive with the weekend.\nVI. Mid-Autumn Festival: The holiday is from September 15 to 17, for a total of 3 days. September 14 (Saturday) is a workday.\nVII. National Day: The holiday is from October 1 to 7, for a total of 7 days. September 29 (Sunday) and October 12 (Saturday) are workdays.\nDuring the holidays, all regions and departments must properly arrange duty, security, safety, and epidemic prevention and control work. In case of major emergencies, report and handle them promptly in accordance with regulations to ensure that the people have a peaceful and safe holiday.\nGeneral Office of the State Council\nOctober 25, 2023

richMainBody

string

Nullable

The full main body in rich text format, within 12,000 characters. The main content of the webpage, including text, images, audio, and video, is converted to text format. Some formatting information, such as tables and code, is retained. The original order of the elements on the webpage is preserved.

"\tTribute\tto\tthe\tworkers\t!\t\n\t[\tBuilding\tthe\tDream\tof\tModernization\t \tPainting\ta\tNew\tPicture\tTogether\t·\tOde\tto\tthe\tWorker\t]\tMaking\tnew\tcontributions\tto\tadvance\tChinese-style\tmodernization\t\n\t<quark-image available_status=\"3\" caption=\"CCTV News Studio\" fetch_status=\"0\" is_broken=\"0\" is_high_quality_chart=\"0\" is_high_quality_text=\"0\" is_watermark=\"0\" ori_height=\"1080\" ori_width=\"1920\" phash=\"13061254655082448525\" relevant_score=\"0.5\" render_height=\"137.046875\" render_width=\"243.65625\" tag=\"CCTV logo, studio, building, scenery\" url=\"http://s2.zimgs.cn/ims?kt=url&amp;key=aHR0cHM6Ly92Mi5jcmkuY24vTTAwLzg2LzAyL3JCQUJDbVkzRzhDQVhFR0pBQUFBQUFBQUFBQTQ0LjE5MjB4MTA4MC5qcGVn&amp;sign=yx:G3TGlZZMQhnxU2bJSDcb_g8xPQ0=&amp;tv=0_0&amp;p=\" value_score=\"0.5\"><quark-ocr>\tCCTV\t \t13\t \tNews\t \tCTVR\t \tZhaojian\tTianxia\t</quark-ocr></quark-image>\t\n\tMore\t>\t>\t>\t \tThe\tMost\tBeautiful\tWorker\t\n\t"

markdownText

string

Optional

The webpage content in Markdown format.

# Notice of the General Office of the State Council on the Arrangement of Some Holidays in 2024_State Council Documents_Chinese Government Website\n\nurl: https://www.gov.cn/govweb/zhengce/zhengceku/202310/content_6911528.htm\n\narticle_title: \n\ntime: \n\n---\n\n<table>\n<tbody>\n<tr>\n<td>\n<table>\n<tbody>\n<tr>\n<td><b>Index Number:</b></td>\n<td>000014349/2023-00063</td>\n<td><b>Subject Classification:</b></td>\n<td>Comprehensive Government Affairs\\Other</td>\n</tr>\n<tr>\n<td><b>Issuing Authority:</b></td>\n<td>General Office of the State Council</td>\n<td><b>Date of Issue:</b></td>\n<td>October 25, 2023</td>\n</tr>\n<tr>\n<td><b>Title:</b></td>\n<td colspan=\"3\">Notice of the General Office of the State Council on the Arrangement of Some Holidays in 2024</td>\n</tr>\n<tr>\n<td><b>Document Number:</b></td>\n<td>Guo Ban Fa Ming Dian [2023] No. 7</td>\n<td><b>Date of Publication:</b></td>\n<td>October 25, 2023</td>\n</tr>\n</tbody>\n</table>\n</td>\n</tr>\n</tbody>\n</table>\n\n<table>\n<tbody>\n<tr>\n<td>\n<table>\n<tbody>\n<tr>\n<td>\n<div>\n<div>\n<p><strong>Notice of the General Office of the State Council on the Arrangement of Some</strong></p>\n<p><strong>Holidays in 2024</strong></p>\n<p><span>Guo Ban Fa Ming Dian [2023] No. 7</span></p>\n<p>To the people's governments of all provinces, autonomous regions, and municipalities directly under the Central Government, all ministries and commissions of the State Council, and all directly affiliated institutions:</p>\n<p>With the approval of the State Council, the specific arrangements for the 2024 New Year's Day, Spring Festival, Qingming Festival, Labor Day, Dragon Boat Festival, Mid-Autumn Festival, and National Day holidays and workday adjustments are hereby notified as follows.</p>\n<p><strong>I. New Year's Day:</strong>January 1 is a holiday, consecutive with the weekend.</p>\n<p><strong>II. Spring Festival:</strong>The holiday is from February 10 to 17, for a total of 8 days. February 4 (Sunday) and February 18 (Sunday) are workdays. All organizations are encouraged to implement systems such as paid annual leave to arrange for employees to rest on New Year's Eve (February 9).</p>\n<p><strong>III. Qingming Festival:</strong>The holiday is from April 4 to 6, for a total of 3 days. April 7 (Sunday) is a workday.</p>\n<p><strong>IV. Labor Day:</strong>The holiday is from May 1 to 5, for a total of 5 days. April 28 (Sunday) and May 11 (Saturday) are workdays.</p>\n<p><strong>V. Dragon Boat Festival:</strong>June 10 is a holiday, consecutive with the weekend.</p>\n<p><strong>VI. Mid-Autumn Festival:</strong>The holiday is from September 15 to 17, for a total of 3 days. September 14 (Saturday) is a workday.</p>\n<p><strong>VII. National Day:</strong>The holiday is from October 1 to 7, for a total of 7 days. September 29 (Sunday) and October 12 (Saturday) are workdays.</p>\n<p>During the holidays, all regions and departments must properly arrange duty, security, safety, and epidemic prevention and control work. In case of major emergencies, report and handle them promptly in accordance with regulations to ensure that the people have a peaceful and safe holiday.</p>\n<p>General Office of the State Council</p>\n<p>October 25, 2023</p>\n</div>\n</div>\n</td>\n</tr>\n</tbody>\n</table>\n</td>\n</tr>\n</tbody>\n</table>

images[]

imageLink

string

Nullable

The image URL.

https://imgbdb4.bendibao.com/shbdb/news/202310/26/20231026112304_25716.jpg

width

int32

This can be left empty.

The width in pixels.

864

height

int32

Nullable

The height in pixels.

1704

pageMap

htmlSnippetTruncate

string

Nullable

Indicates whether the dynamic webpage summary is truncated. The summary is truncated if it exceeds the length limit.

  • 0: Not truncated

  • 1: Truncated

0

mainTextTruncate

string

This parameter is optional.

Indicates whether the main body of the webpage is truncated. The text is truncated if it exceeds the length limit.

  • 0: Not truncated

  • 1: Truncated

  • 2: The main body is not available (for example, if mainText is empty).

1

hostname

string

This field can be left empty.

The site name.

Xinhuanet

hostLogo

string

Optional

The site logo.

https://s2.zimgs.cn/ims?kt=url&at=smstruct&key=aHR0cHM6Ly9ndy5hbGljZG4uY29tL0wxLzcyMy8xNTY1MjU2NjAwLzJhL2YwL2I0LzJhZjBiNDQxMGI5YmVlMDVjOGVlNGJmODk3MTNkNTFjLnBuZw==&sign=yx:CUlNNQVJQjFrk3Kxt2F3KWhTOFU=&tv=400_400

siteLabel

string

Can be left empty

The site label. The following labels are supported:

  • Authoritative media

  • Party and government organizations

Note

This field can help determine authority. It indicates media recognized by the government, so the recall rate is not high.

Authoritative media

sceneItems[]

Nullable

type

string

This field cannot be empty.

The type. For more information about the supported types, see Overview of SceneItem for scenario-based calls.

time

detail

string

Required

The details. For more information about the struct, see Overview of SceneItem for scenario-based calls.

{

"title": "Tokyo Time",

"targetTimeZone": "Asia/Tokyo",

"targetTimeMillisecond": "1733999009797",

"targetTime": "2024-12-12 18:23:29",

"beijingTimeZone": "PRC",

"beijingTimeMillisecond": "1733995409797"

}

queryContext

originalQuery

query

string

Required

The original request: query.

How are BYD's recent sales

timeRange

string

Nullable

The original request: timeRange.

NoLimit

industry

string

Optional

The original request: industry.

page

string

This field is optional.

The original request: page.

1

rewrite

enabled

boolean

The value cannot be empty.

Indicates whether query rewrite is enabled for this request. The system automatically determines whether to enable this feature. It is enabled if the rewrite ratio for the customer exceeds 5%.

true

timeRange

string

Optional.

The rewritten timeRange. This parameter is returned only if the rewritten value is different from the original timeRange.

Important

If you specify a value other than NoLimit for timeRange, timeRange rewrite is disabled.

OneMonth

searchInformation

total

int64

A value is required.

The total number of entries.

8230595

searchTime

int64

This field cannot be empty.

The search duration.

1441

Error codes

API error codes

Status

Error code

Error message

Solution

404

InvalidAccessKeyId.NotFound

Specified access key is not found.

Check and make sure that your AccessKey ID and AccessKey secret are correct.

403

Retrieval.NotActivate

Please activate AI search service

Place an order or contact your account manager to activate the service.

403

Retrieval.Arrears

Please recharge first.

Your account balance is insufficient. Top up your account.

403

Retrieval.NotAuthorised

Please authorize the AliyunIQSFullAccess privilege to the sub-account.

The RAM user is not granted the required permissions. For more information, see Create a RAM user and grant permissions.

403

Retrieval.TestUserPeriodExpired

The test period has expired.

The trial period has expired (valid for 15 days after placing the order). Contact your Alibaba Cloud account manager to switch to a paid subscription.

429

Retrieval.Throttling.User

Request was denied due to user flow control.

The request rate exceeds the limit. Contact your Alibaba Cloud account manager to upgrade your specifications.

429

Retrieval.TestUserQueryPerDayExceeded

The query per day exceed the limit.

The number of queries exceeds the daily limit for trial use (1,000 queries/day). Contact your Alibaba Cloud account manager to switch to a paid subscription.