日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

文檔搜索 Demo

通過SDK 調用問天搜索引擎進行數據檢索。

代碼示例

package main

import (
    "fmt"
    util "github.com/alibabacloud-go/tea-utils/service"
    "github.com/alibabacloud-go/tea/tea"
    ha3engine "github.com/aliyun/alibabacloud-ha3-go-sdk/client"
)

func main() {
    
    //創建請求用客戶端實例
    //Endpoint 為 要訪問服務的區域實例域名.
    //AccessUserName AccessPassWord 用于構造鑒權信息.
    
    config := &ha3engine.Config{
        Endpoint:       tea.String("<Endpoint>"),
        InstanceId:     tea.String("<InstanceId>"),
        AccessUserName: tea.String("<AccessUserName>"),
        AccessPassWord: tea.String("<AccessPassWord>"),
    }
    
    // New  一個client, 用以發送請求.
    client, _clientErr := ha3engine.NewClient(config)
    
    // 如果 NewClient 過程中出現異常. 則 返回 _clientErr 且輸出 錯誤信息.
    if _clientErr != nil {
        fmt.Println(_clientErr)
        return
    }
    runtime := &util.RuntimeOptions{
        ConnectTimeout: tea.Int(5000),
        ReadTimeout:    tea.Int(10000),
        Autoretry:      tea.Bool(false),
        IgnoreSSL:      tea.Bool(false),
        MaxIdleConns:   tea.Int(50),
        HttpProxy:      tea.String("http://116.*.*.187:8088"),
    }
    
    HastringQuerySearch(client)
    HastringQuerySearchWithOptions(client, runtime)
    HaStructQuerySearch(client)
    HaStructQuerySearchWithOptions(client, runtime)
    SQLstringQuerySearch(client)
    SQLstringQuerySearchWithOptions(client, runtime)
    SQLStructQuerySearch(client)
    SQLStructQuerySearchWithOptions(client, runtime)
}

func HastringQuerySearch(client *ha3engine.Client) {
    
    searchRequestModel := &ha3engine.SearchRequestModel{}
    searchQuery := &ha3engine.SearchQuery{}
    aaa := "config=start:0,hit:10,format:json,fetch_summary_type:pk,qrs_chain:search&&query=id:'5335540507182487716'&&cluster=general"
    fmt.Println(aaa)
    searchQuery.SetQuery(aaa)
    
    searchRequestModel.SetQuery(searchQuery)
    
    response, _requestErr := client.Search(searchRequestModel)
    
    // 如果 發送請求 過程中出現異常. 則 返回 _requestErr 且輸出 錯誤信息.
    if _requestErr != nil {
        fmt.Println(_requestErr)
        return
    }
    
    // 輸出正常返回的 response 內容.
    fmt.Println(response)
    
}

func HastringQuerySearchWithOptions(client *ha3engine.Client, runtime *util.RuntimeOptions) {
    
    searchRequestModel := &ha3engine.SearchRequestModel{}
    searchQuery := &ha3engine.SearchQuery{}
    aaa := "config=start:0,hit:10,format:json,fetch_summary_type:pk,qrs_chain:search&&query=id:'5335540507182487716'&&cluster=general"
    fmt.Println(aaa)
    searchQuery.SetQuery(aaa)
    
    searchRequestModel.SetQuery(searchQuery)
    
    response, _requestErr := client.SearchWithOptions(searchRequestModel, runtime)
    
    // 如果 發送請求 過程中出現異常. 則 返回 _requestErr 且輸出 錯誤信息.
    if _requestErr != nil {
        fmt.Println(_requestErr)
        return
    }
    
    // 輸出正常返回的 response 內容.
    fmt.Println(response)
    
}

func HaStructQuerySearch(client *ha3engine.Client) {
    
    searchRequestModel := &ha3engine.SearchRequestModel{}
    searchQuery := &ha3engine.SearchQuery{}
    
    haquery := &ha3engine.HaQuery{}
    haquery.SetQuery("id:'5335540507182487716'")
    haquery.SetCluster("general")
    haQueryconfigClause := &ha3engine.HaQueryconfigClause{}
    haQueryconfigClause.SetFormat("json")
    haQueryconfigClause.SetHit("10")
    haQueryconfigClause.SetStart("0")
    CustomConfig := map[string]*string{
        "fetch_summary_type": tea.String("pk"),
        "qrs_chain":          tea.String("search"),
    }
    
    haQueryconfigClause.SetCustomConfig(CustomConfig)
    haquery.SetConfig(haQueryconfigClause)
    
    result, _err := client.BuildHaSearchQuery(haquery)
    if _err != nil {
        fmt.Println(_err)
        return
    }
    fmt.Println(tea.StringValue(result))
    searchQuery.SetQuery(tea.StringValue(result))
    
    searchRequestModel.SetQuery(searchQuery)
    
    response, _requestErr := client.Search(searchRequestModel)
    
    // 如果 發送請求 過程中出現異常. 則 返回 _requestErr 且輸出 錯誤信息.
    if _requestErr != nil {
        fmt.Println(_requestErr)
        return
    }
    
    // 輸出正常返回的 response 內容.
    fmt.Println(response)
    
}

func HaStructQuerySearchWithOptions(client *ha3engine.Client, runtime *util.RuntimeOptions) {
    
    searchRequestModel := &ha3engine.SearchRequestModel{}
    searchQuery := &ha3engine.SearchQuery{}
    
    haquery := &ha3engine.HaQuery{}
    haquery.SetQuery("id:'5335540507182487716'")
    haquery.SetCluster("general")
    haQueryconfigClause := &ha3engine.HaQueryconfigClause{}
    haQueryconfigClause.SetFormat("json")
    haQueryconfigClause.SetHit("10")
    haQueryconfigClause.SetStart("0")
    CustomConfig := map[string]*string{
        "fetch_summary_type": tea.String("pk"),
        "qrs_chain":          tea.String("search"),
    }
    
    haQueryconfigClause.SetCustomConfig(CustomConfig)
    haquery.SetConfig(haQueryconfigClause)
    
    result, _err := client.BuildHaSearchQuery(haquery)
    if _err != nil {
        fmt.Println(_err)
        return
    }
    fmt.Println(tea.StringValue(result))
    searchQuery.SetQuery(tea.StringValue(result))
    
    searchRequestModel.SetQuery(searchQuery)
    
    response, _requestErr := client.SearchWithOptions(searchRequestModel, runtime)
    
    // 如果 發送請求 過程中出現異常. 則 返回 _requestErr 且輸出 錯誤信息.
    if _requestErr != nil {
        fmt.Println(_requestErr)
        return
    }
    
    // 輸出正常返回的 response 內容.
    fmt.Println(response)
    
}

func SQLstringQuerySearch(client *ha3engine.Client) {
    
    searchRequestModel := &ha3engine.SearchRequestModel{}
    searchQuery := &ha3engine.SearchQuery{}
    
    searchQuery.SetSql("select * from odps")
    searchRequestModel.SetQuery(searchQuery)
    
    // 發送請求的方法調用.
    response, _requestErr := client.Search(searchRequestModel)
    
    //
    
    // 如果 發送請求 過程中出現異常. 則 返回 _requestErr 且輸出 錯誤信息.
    if _requestErr != nil {
        fmt.Println(_requestErr)
        return
    }
    
    // 輸出正常返回的 response 內容.
    fmt.Println(response)
    
}

func SQLstringQuerySearchWithOptions(client *ha3engine.Client, runtime *util.RuntimeOptions) {
    
    searchRequestModel := &ha3engine.SearchRequestModel{}
    searchQuery := &ha3engine.SearchQuery{}
    
    searchQuery.SetSql("select * from odps")
    searchRequestModel.SetQuery(searchQuery)
    
    // 發送請求的方法調用.
    response, _requestErr := client.SearchWithOptions(searchRequestModel, runtime)
    
    //
    
    // 如果 發送請求 過程中出現異常. 則 返回 _requestErr 且輸出 錯誤信息.
    if _requestErr != nil {
        fmt.Println(_requestErr)
        return
    }
    
    // 輸出正常返回的 response 內容.
    fmt.Println(response)
    
}

func SQLStructQuerySearch(client *ha3engine.Client) {
    
    searchQuery1 := &ha3engine.SearchQuery{}
    sqlquery := &ha3engine.SQLQuery{}
    sqlquery.SetQuery("select * from odps")
    kvPair := map[string]*string{
        "format": tea.String("json"),
    }
    
    sqlquery.SetKvpairs(kvPair)
    
    result, _err := client.BuildSQLSearchQuery(sqlquery)
    if _err != nil {
        fmt.Println(_err)
        return
    }
    searchQuery1.SetSql(tea.StringValue(result))
    
    searchRequestModel1 := &ha3engine.SearchRequestModel{}
    searchRequestModel1.SetQuery(searchQuery1)
    
    // 發送請求的方法調用.
    response1, _requestErr1 := client.Search(searchRequestModel1)
    
    // 如果 發送請求 過程中出現異常. 則 返回 _requestErr 且輸出 錯誤信息.
    if _requestErr1 != nil {
        fmt.Println(_requestErr1)
        return
    }
    
    // 輸出正常返回的 response 內容.
    fmt.Println(response1)
    
}

func SQLStructQuerySearchWithOptions(client *ha3engine.Client, runtime *util.RuntimeOptions) {
    
    searchQuery1 := &ha3engine.SearchQuery{}
    sqlquery := &ha3engine.SQLQuery{}
    sqlquery.SetQuery("select * from odps")
    kvPair := map[string]*string{
        "format": tea.String("json"),
    }
    
    sqlquery.SetKvpairs(kvPair)
    
    result, _err := client.BuildSQLSearchQuery(sqlquery)
    if _err != nil {
        fmt.Println(_err)
        return
    }
    searchQuery1.SetSql(tea.StringValue(result))
    
    searchRequestModel1 := &ha3engine.SearchRequestModel{}
    searchRequestModel1.SetQuery(searchQuery1)
    
    // 發送請求的方法調用.
    response1, _requestErr1 := client.SearchWithOptions(searchRequestModel1, runtime)
    
    // 如果 發送請求 過程中出現異常. 則 返回 _requestErr 且輸出 錯誤信息.
    if _requestErr1 != nil {
        fmt.Println(_requestErr1)
        return
    }
    
    // 輸出正常返回的 response 內容.
    fmt.Println(response1)
    
}