更新时间:2024-08-19 GMT+08:00
分享

搜索服务管理开发指导

涉及的接口

表1 涉及的接口

接口名称

说明

https://{Endpoint}/rdm_{appID}_app/services/rdm/basic/api/searchservicedefine/create

创建搜索服务。

https://{Endpoint}/rdm_{appID}_app/services/rdm/basic/api/searchServiceIndexDefinition/saveList

添加索引。

https://{Endpoint}/rdm_{appID}_app/services/rdm/basic/api/searchServColumnController/saveDataServIndexEntityList

添加服务配置。

https://{Endpoint}/rdm_{appID}_app/services/rdm/basic/api/searchservicedefine/publishSingle

发布搜索服务。

https://{Endpoint}/rdm_{appID}_app/services/rdm/basic/api/searchServ/startEsSync/{serNumber}

同步搜索服务。

步骤1:定义搜索服务

  1. 准备工作。

    应用运行态中获取定义搜索服务的API信息,具体操作请参见全量数据服务

  2. 根据实际业务需求,调用API创建搜索服务。

    • 请求示例
      POST https://{Endpoint}/rdm_{appID}_app/services/rdm/basic/api/searchservicedefine/create
      
      {
          "params": {
              "createDTO": {
                  "name": "搜索服务示例",
                  "description": "搜索服务示例",
                  "descriptionEn": "Sample",
                  "nameEn": "Sample",
                  "owner": "",
                  "tenantAliasName": "TestDME"
              },
              "tags": []
          }
      }

      其中,{Endpoint}表示数据建模引擎所在域名或IP地址,{appID}表示应用ID,“name”“nameEn”“description”“descriptionEn”表示搜索服务的中英文名称和中英文描述。

    • 响应示例
      {
          "result": "SUCCESS",
          "data": [
              {
                  "id": "505115507221864448",
                  "className": "XDMSearchServDefine",
                  "name": "搜索服务示例",
                  "description": "搜索服务示例",
                  "kiaguid": null,
                  "securityLevel": "internal",
                  "master": {
                      "id": "505115507255418880",
                      "creator": "TestAccount2 5547b9adee************8aac057d2c",
                      "modifier": "TestAccount2 5547b9adee************8aac057d2c",
                      "createTime": "2023-05-30T12:28:41.522+0000",
                      "lastUpdateTime": "2023-05-30T12:28:41.522+0000",
                      "rdmVersion": 1,
                      "rdmDeleteFlag": 0,
                      "rdmExtensionType": "XDMSearchServDefineMaster",
                      "tenant": {
                          "id": "-1",
                          "creator": "xdmAdmin",
                          "modifier": "xdmAdmin",
                          "createTime": "2022-12-01T11:24:39.000+0000",
                          "lastUpdateTime": "2022-12-01T11:24:39.000+0000",
                          "rdmVersion": 1,
                          "rdmDeleteFlag": 0,
                          "rdmExtensionType": "Tenant",
                          "tenant": null,
                          "className": "Tenant",
                          "name": "basicTenant",
                          "description": "默认租户",
                          "kiaguid": null,
                          "securityLevel": "internal",
                          "code": "basicTenant",
                          "disableFlag": false,
                          "dataSource": "DefaultDataSource"
                      },
                      "className": "XDMSearchServDefineMaster",
                      "servNumber": "SS60466196"
                  },
                  "branch": {
                      "id": "505115507255418881",
                      "creator": "TestAccount2 5547b9adee************8aac057d2c",
                      "modifier": "TestAccount2 5547b9adee************8aac057d2c",
                      "createTime": "2023-05-30T12:28:41.569+0000",
                      "lastUpdateTime": "2023-05-30T12:28:41.569+0000",
                      "rdmVersion": 1,
                      "rdmDeleteFlag": 0,
                      "rdmExtensionType": "XDMSearchServDefineBranch",
                      "tenant": {
                          "id": "-1",
                          "creator": "xdmAdmin",
                          "modifier": "xdmAdmin",
                          "createTime": "2022-12-01T11:24:39.000+0000",
                          "lastUpdateTime": "2022-12-01T11:24:39.000+0000",
                          "rdmVersion": 1,
                          "rdmDeleteFlag": 0,
                          "rdmExtensionType": "Tenant",
                          "tenant": null,
                          "className": "Tenant",
                          "name": "basicTenant",
                          "description": "默认租户",
                          "kiaguid": null,
                          "securityLevel": "internal",
                          "code": "basicTenant",
                          "disableFlag": false,
                          "dataSource": "DefaultDataSource"
                      },
                      "className": "XDMSearchServDefineBranch",
                      "version": "A"
                  },
                  "latest": true,
                  "latestIteration": true,
                  "versionCode": 1,
                  "iteration": 1,
                  "version": "A",
                  "latestVersion": true,
                  "workingCopy": true,
                  "workingState": {
                      "code": "INWORK",
                      "cnName": "工作中",
                      "enName": "inwork",
                      "alias": "INWORK"
                  },
                  "checkOutUserName": "TestAccount2 5547b9adee54423cbc05978aac057d2c",
                  "checkOutTime": "2023-05-30T12:28:41.514+0000",
                  "preVersionId": null,
                  "owner": "",
                  "descriptionEn": "Sample",
                  "esindexId": null,
                  "dmentityVersion": null,
                  "dmentityVersionName": null,
                  "step": null,
                  "nameEn": "Sample",
                  "needRefresh": false,
                  "graphId": null,
                  "lifecycleTemplate": null,
                  "lifecycleState": null,
                  "disableFlag": false
              }
          ],
          "errors": []
      }

步骤2:添加索引

  1. 准备工作。

    应用运行态中获取添加索引的API信息,具体操作请参见全量数据服务

  2. 根据实际业务需求,调用API添加索引。

    • 请求示例
      POST http://{Endpoint}/rdm_{appID}_app/services/rdm/basic/api/searchServiceIndexDefinition/saveList
      
      {
          "params": {
              "searchServId": "505115507221864448",
              "searchServName": "搜索服务示例",
              "indexServColuVOList": [
                  {
                      "id": null,
                      "indexName": "SampleIndex",
                      "indexDesc": "",
                      "indexType": "TEXT",
                      "operator": null,
                      "inputSeparator": null,
                      "segMethod": "NOWORD",
                      "segOption": "NOTINVOLVED",
                      "searchUsage": true,
                      "keywordUsage": true,
                      "displayUsage": true,
                      "matchType": "FUZZY",
                      "key": "indexDefinition43"
                  }
              ]
          }
      }

      其中,{Endpoint}表示数据建模引擎所在域名或IP地址,{appID}表示应用ID,“indexName”“indexDesc”“indexType”表示索引名称、描述和类型。

    • 响应示例
      {
          "result": "SUCCESS",
          "data": [
              {
                  "id": "505115594543079424",
                  "rdmExtensionType": "XDMSearchIndexEntity",
                  "className": "XDMSearchIndexEntity",
                  "searchServId": "505115507221864448",
                  "indexName": "SampleIndex",
                  "matchType": {
                      "code": "fuzzy",
                      "cnName": "模糊匹配",
                      "enName": "fuzzy",
                      "alias": "FUZZY"
                  },
                  "displayUsage": true,
                  "keywordUsage": true,
                  "operator": null,
                  "segOption": {
                      "code": "notInvolved",
                      "cnName": "不涉及",
                      "enName": "notInvolved",
                      "alias": "NOTINVOLVED"
                  },
                  "indexMaxFieldSize": null,
                  "indexType": {
                      "code": "Text",
                      "cnName": "文本",
                      "enName": "Text",
                      "alias": "TEXT"
                  },
                  "indexDesc": "",
                  "searchUsage": true,
                  "segMethod": {
                      "code": "noWord",
                      "cnName": "不分词",
                      "enName": "noWord",
                      "alias": "NOWORD"
                  },
                  "searchServName": "搜索服务示例",
                  "inputSeparator": null,
                  "relationIndexEntityList": null
              }
          ],
          "errors": []
      }

步骤3:添加服务配置

  1. 准备工作。

    应用运行态中获取添加服务配置的API信息,具体操作请参见全量数据服务

  2. 根据实际业务需求,调用API添加服务配置。

    • 请求示例
      POST http://{Endpoint}/rdm_{appID}_app/services/rdm/basic/api/searchServColumnController/saveDataServIndexEntityList
      
      {
          "params": {
              "searchServId": "505115507221864448",
              "searchServIndexEntityVOList": [
                  {
                      "entityName": "TestData",
                      "entityNameEn": "TestData",
                      "dataServRelationVOList": [
                          {
                              "attrName": "Code",
                              "attrDesc": null,
                              "searchIndexId": "505115594543079424",
                              "indexType": "TEXT",
                              "dataModelVersionNameEn": "Tenant",
                              "extendAttr": false,
                              "attrType": "STRING",
                              "sortNo": 1
                          }
                      ]
                  }
              ]
          }
      }

      其中,{Endpoint}表示数据建模引擎所在域名或IP地址,{appID}表示应用ID,“searchServIndexEntityVOList”表示服务配置中选中的实体和属性。

    • 响应示例
      {
          "result": "SUCCESS",
          "data": [],
          "errors": []
      }

步骤4:发布和验证搜索服务

  1. 准备工作。

    应用运行态中获取发布搜索服务的API信息,具体操作请参见全量数据服务

  2. 完成搜索服务的配置后,调用API发布搜索服务。

    • 请求示例
      POST http://{Endpoint}/rdm_{appID}_app/services/rdm/basic/api/searchservicedefine/publishSingle
      
      {
          "params": "505115507221864448"
      }

      其中,{Endpoint}表示数据建模引擎所在域名或IP地址,{appID}表示应用ID,“params”表示待发布的搜索服务ID。

    • 响应示例
      {
          "result": "SUCCESS",
          "data": [],
          "errors": []
      }

步骤5:同步搜索服务数据

  1. 准备工作。

    应用运行态中获取同步搜索服务的API信息,具体操作请参见全量数据服务

  2. 根据实际业务需求,调用API同步搜索服务数据。

    • 请求示例
      PUT http://{Endpoint}/rdm_{appID}_app/services/rdm/basic/api/searchServ/startEsSync/{serNumber}

      其中,{Endpoint}表示数据建模引擎所在域名或IP地址,{appID}表示应用ID,“serNumber”待同步的搜索服务ID。

    • 响应示例
      {
          "result": "SUCCESS",
          "data": [],
          "errors": []
      }

相关文档