小编Rad*_*a.S的帖子

在gRPC protoc缓冲区golang中创建Map [string] interface {}类型的变量

我正在使用grpc golang在客户端和服务器应用程序之间进行通信.下面是protoc缓冲区的代码.

syntax = "proto3";
package Trail;

service TrailFunc {
  rpc HelloWorld (Request) returns (Reply) {}
}

// The request message containing the user's name.
message Request {
  map<string,string> inputVar = 1;
}
// The response message containing the greetings
message Reply {
  string outputVar = 1;
}
Run Code Online (Sandbox Code Playgroud)

我需要在消息数据结构中创建一个类型为map [string] interface {}的字段inputVar,而不是map [string] string.我怎样才能实现它?提前致谢.

go grpc protoc

9
推荐指数
2
解决办法
1万
查看次数

提升完成建议器的输入字段

我使用完成建议器自动完成..这些是我的文件

/* doc 1 */
{
    Title: CineMAX: Inorbit Mall, Cyberabad
    Suggest: {
        input: [
            CineMAX:
            Inorbit
            Mall
            Cyberabad
            CineMAX: Inorbit Mall, Cyberabad
        ]
        output: CineMAX: Inorbit Mall, Cyberabad
        payload: {
        ....
        }
        weight: 1
    }
}

/* doc 2 */
{
    Title: INOX: Kolkata
    Suggest: {
        input: [
            INOX:
            Kolkata
            INOX: Kolkata
        ]
        output: INOX: Kolkata 
        payload: {
            ....
        }
        weight: 1
    }
}
Run Code Online (Sandbox Code Playgroud)

我使用完成查询如下

{
    "suggestion":{
       "text":"inox",
       "completion":{
           "field":"Suggest",
           "fuzzy":{
               "edit_distance":1,
               "transpositions":true,
               "prefix_length":1,
               "min_length":4
           }
       }

    }       
} …
Run Code Online (Sandbox Code Playgroud)

search full-text-search elasticsearch

6
推荐指数
1
解决办法
795
查看次数

标签 统计

elasticsearch ×1

full-text-search ×1

go ×1

grpc ×1

protoc ×1

search ×1