GetSearchCodePreview
Retrieves preview code snippets based on the document ID and keyword.
Try it now
Test
RAM authorization
Request syntax
GET /search/code_preview HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| organizationId |
string |
Yes |
The enterprise identifier, also known as the enterprise ID. This string can be obtained from the Yunxiao URL, such as https://devops.aliyun.com/organization/[OrganizationId]. |
627475075b46541dd2ff01bc |
| docId |
string |
Yes |
The document ID. |
60d54f3daccf2bbd6659f3ad/gitlabhq/master/config/environments/test.rb |
| keyword |
string |
Yes |
The search keyword. |
test |
| isDsl |
boolean |
No |
Specifies whether the search uses DSL. |
false |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| requestId |
string |
The request ID. |
A7586FEB-E48D-5579-983F-74981FBFF627 |
| errorCode |
string |
The error code. |
SYSTEM_UNKNOWN_ERROR |
| errorMessage |
string |
The error message. |
"" |
| success |
boolean |
Indicates whether the call was successful. |
true |
| result |
object |
The Elasticsearch search results. |
|
| docId |
string |
The document ID. |
doc-example |
| highlightTextMap |
object |
The highlighted text information. |
|
| organizationId |
string |
The Yunxiao enterprise ID. |
5ffd468b1e45db3c1cc26ad6 |
| fileName |
string |
The highlighted file name. |
test.rb |
| clob |
string |
The matched snippet from the file content. |
public class Demo { } |
| source |
object |
The source information returned by Elasticsearch. |
|
| repoPath |
string |
The full path of the code repository, including the full group path. |
codeup/test-repo |
| fileName |
string |
The file name. |
test.rb |
| filePath |
string |
The full path of the file. |
config/environments/test.rb |
| language |
string |
The programming language. |
Ruby |
| checkinDate |
string |
The time of the most recent commit. |
2022-12-12 12:12:12 |
| branch |
string |
The branch name. |
master |
| organizationId |
string |
The enterprise identifier, also known as the enterprise ID. This string can be obtained from the Yunxiao URL, such as https://devops.aliyun.com/organization/[OrganizationId]. |
5f9f9f6122a8c7ff3934f99a |
Examples
Success response
JSON format
{
"requestId": "A7586FEB-E48D-5579-983F-74981FBFF627",
"errorCode": "SYSTEM_UNKNOWN_ERROR",
"errorMessage": "\"\"",
"success": true,
"result": {
"docId": "xxx",
"highlightTextMap": {
"organizationId": "5ffd468b1e45db3c1cc26ad6",
"fileName": "test.rb",
"clob": "xxx"
},
"source": {
"repoPath": "codeup/test-repo",
"fileName": "test.rb",
"filePath": "config/environments/test.rb",
"language": "Ruby",
"checkinDate": "2022-12-12 12:12:12",
"branch": "master",
"organizationId": "5f9f9f6122a8c7ff3934f99a"
}
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.