Package Search Results - Fetch Package Search Results

为搜索文本提供一组结果。

POST https://almsearch.dev.azure.com/{organization}/_apis/search/packagesearchresults?api-version=7.1-preview.1

URI 参数

名称 必需 类型 说明
organization
path True

string

Azure DevOps 组织的名称。

api-version
query True

string

要使用的 API 版本。 这应设置为“7.1-preview.1”才能使用此版本的 API。

请求正文

名称 类型 说明
$orderBy

SortOption[]

用于对搜索结果进行排序的选项。 如果设置为 null,则返回的结果将按相关性排序。 如果提供了多个排序选项,则结果将按 OrderBy 中指定的顺序排序。

$skip

integer

要跳过的结果数。

$top

integer

要返回的结果数。

filters

object

要应用的筛选器。 如果没有要应用的筛选器,则将其设置为 null。

includeFacets

boolean

在结果中选择分面的标志。 默认行为为 false。

searchText

string

搜索文本。

响应

名称 类型 说明
200 OK

PackageSearchResponseContent

成功的操作

Headers

ActivityId: string

安全性

oauth2

Type: oauth2
Flow: accessCode
Authorization URL: https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
Token URL: https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer

Scopes

名称 说明
vso.packaging 授予读取源和包的能力。 此外,还授予搜索包的能力。

示例

Sample Request

POST https://almsearch.dev.azure.com/{organization}/_apis/search/packagesearchresults?api-version=7.1-preview.1

{
  "$skip": 0,
  "$top": 50,
  "$orderBy": null,
  "includeFacets": true,
  "searchText": "microsoft applicationinsight package",
  "filters": {
    "Feeds": [
      "ApplicationInsights-Team"
    ],
    "View": [
      "local"
    ],
    "ProtocolType": [
      "Nuget",
      "Npm"
    ]
  }
}

Sample Response

{
  "count": 3,
  "results": [
    {
      "name": "@microsoft/applicationinsights-mezzurite",
      "id": "0adc5b40-8b48-4a42-ac5e-93da78206d27",
      "description": "Logging Extention for Mezzurtie Timing Package",
      "protocolType": "Npm",
      "feeds": [
        {
          "collectionId": "0efb4611-d565-4cd1-9a64-7d6cb6d7d5f0",
          "collectionName": "mseng",
          "feedId": "cd3f7228-b239-4ef5-8d3b-ee9c3bc79bc2",
          "feedName": "ApplicationInsights-Team",
          "packageUrl": "https://dev.azure.com/mseng/_packaging?feed=ApplicationInsights-Team&_a=package&package=@microsoft/applicationinsights-mezzurite&version=1.0.0&protocolType=Npm",
          "latestVersion": "1.0.0",
          "latestMatchedVersion": "1.0.0",
          "views": [
            "local"
          ]
        }
      ],
      "hits": [
        {
          "fieldReferenceName": "name",
          "highlights": [
            "@<highlighthit>microsoft</highlighthit>/<highlighthit>applicationinsights</highlighthit>-mezzurite"
          ]
        },
        {
          "fieldReferenceName": "description",
          "highlights": [
            "Logging Extention for Mezzurtie Timing <highlighthit>Package</highlighthit>"
          ]
        }
      ]
    },
    {
      "name": "Microsoft.ApplicationInsights.Masi.Tracing",
      "id": "5b709505-a14f-4d2c-b172-21f1e6fc0562",
      "description": "The MASI tracing package allowing you to send log messages with activity context to Application Insights and to Windows Azure Diagnostics easily",
      "protocolType": "NuGet",
      "feeds": [
        {
          "collectionId": "0efb4611-d565-4cd1-9a64-7d6cb6d7d5f0",
          "collectionName": "mseng",
          "feedId": "cd3f7228-b239-4ef5-8d3b-ee9c3bc79bc2",
          "feedName": "ApplicationInsights-Team",
          "packageUrl": "https://dev.azure.com/mseng/_packaging?feed=ApplicationInsights-Team&_a=package&package=Microsoft.ApplicationInsights.Masi.Tracing&version=1.0.13.2-build00132-2&protocolType=NuGet",
          "latestVersion": "1.0.13.2-build00132-2",
          "latestMatchedVersion": "1.0.13.2-build00132-2",
          "views": [
            "local"
          ]
        }
      ],
      "hits": [
        {
          "fieldReferenceName": "name",
          "highlights": [
            "<highlighthit>Microsoft</highlighthit>.<highlighthit>ApplicationInsights</highlighthit>.Masi.Tracing"
          ]
        },
        {
          "fieldReferenceName": "description",
          "highlights": [
            "The MASI tracing <highlighthit>package</highlighthit> allowing you to send log messages with activity context to Application"
          ]
        }
      ]
    },
    {
      "name": "Microsoft.ApplicationInsights.Agent.StartupTask",
      "id": "60c357c1-69bf-4c9b-8fe0-a8ad7e50a5f9",
      "description": "Application Insights Agent startup task. This package adds a startup task for installing Application Insights Agent to enable additional Application Insights Telemetry.",
      "protocolType": "NuGet",
      "feeds": [
        {
          "collectionId": "0efb4611-d565-4cd1-9a64-7d6cb6d7d5f0",
          "collectionName": "mseng",
          "feedId": "cd3f7228-b239-4ef5-8d3b-ee9c3bc79bc2",
          "feedName": "ApplicationInsights-Team",
          "packageUrl": "https://dev.azure.com/mseng/_packaging?feed=ApplicationInsights-Team&_a=package&package=Microsoft.ApplicationInsights.Agent.StartupTask&version=1.0.5&protocolType=NuGet",
          "latestVersion": "1.0.5",
          "latestMatchedVersion": "1.0.5",
          "views": [
            "local"
          ]
        }
      ],
      "hits": [
        {
          "fieldReferenceName": "name",
          "highlights": [
            "<highlighthit>Microsoft</highlighthit>.<highlighthit>ApplicationInsights</highlighthit>.Agent.StartupTask"
          ]
        },
        {
          "fieldReferenceName": "description",
          "highlights": [
            "This <highlighthit>package</highlighthit> adds a startup task for installing Application Insights Agent to enable additional"
          ]
        }
      ]
    }
  ],
  "infoCode": 0,
  "facets": {
    "ProtocolType": [
      {
        "name": "Npm",
        "id": "Npm",
        "resultCount": 1
      },
      {
        "name": "NuGet",
        "id": "NuGet",
        "resultCount": 2
      }
    ],
    "Feeds": [
      {
        "name": "ApexPreRelease",
        "id": "ApexPreRelease",
        "resultCount": 4
      },
      {
        "name": "ApplicationInsights-dotnet-develop",
        "id": "ApplicationInsights-dotnet-develop",
        "resultCount": 3
      },
      {
        "name": "ApplicationInsights-Team",
        "id": "ApplicationInsights-Team",
        "resultCount": 3
      },
      {
        "name": "ArtifactTool",
        "id": "ArtifactTool",
        "resultCount": 1
      },
      {
        "name": "Axon.Dependencies",
        "id": "Axon.Dependencies",
        "resultCount": 4
      },
      {
        "name": "CloudBuild",
        "id": "CloudBuild",
        "resultCount": 1
      },
      {
        "name": "CloudBuildTest",
        "id": "CloudBuildTest",
        "resultCount": 1
      },
      {
        "name": "CodeFlow",
        "id": "CodeFlow",
        "resultCount": 3
      },
      {
        "name": "Codex-Deps",
        "id": "Codex-Deps",
        "resultCount": 4
      },
      {
        "name": "Kusto-Internal",
        "id": "Kusto-Internal",
        "resultCount": 4
      },
      {
        "name": "MSCredProvider",
        "id": "MSCredProvider",
        "resultCount": 2
      },
      {
        "name": "VS",
        "id": "VS",
        "resultCount": 7
      },
      {
        "name": "VsoMicrosoftExternals",
        "id": "VsoMicrosoftExternals",
        "resultCount": 3
      }
    ],
    "View": [
      {
        "name": "Local",
        "id": "Local",
        "resultCount": 3
      }
    ]
  }
}

定义

名称 说明
FeedInfo

定义源的详细信息。

PackageHit

在包结果的 字段中定义匹配的字词。

PackageResult

定义与包搜索请求匹配的包结果。

PackageSearchRequest

定义包搜索请求。

PackageSearchResponseContent

定义为包搜索请求返回的响应项。

SortOption

定义如何对结果进行排序。

FeedInfo

定义源的详细信息。

名称 类型 说明
collectionId

string

集合的 ID。

collectionName

string

集合的名称。

feedId

string

源的 ID。

feedName

string

源的名称。

latestMatchedVersion

string

此源中包的最新匹配版本。

latestVersion

string

此源中包的最新版本。

packageUrl

string

此源中包的 URL。

views

string[]

包含匹配包的视图列表。

PackageHit

在包结果的 字段中定义匹配的字词。

名称 类型 说明
fieldReferenceName

string

突出显示的字段的引用名称。

highlights

string[]

字段的匹配/突出显示的代码段。

PackageResult

定义与包搜索请求匹配的包结果。

名称 类型 说明
description

string

包的说明。

feeds

FeedInfo[]

包含匹配包的源列表。

hits

PackageHit[]

匹配项的突出显示字段列表。

id

string

包的 ID。

name

string

包的名称。

protocolType

string

包的类型。

PackageSearchRequest

定义包搜索请求。

名称 类型 说明
$orderBy

SortOption[]

用于对搜索结果进行排序的选项。 如果设置为 null,则返回的结果将按相关性排序。 如果提供了多个排序选项,则结果将按 OrderBy 中指定的顺序排序。

$skip

integer

要跳过的结果数。

$top

integer

要返回的结果数。

filters

object

要应用的筛选器。 如果没有要应用的筛选器,则将其设置为 null。

includeFacets

boolean

在结果中选择分面的标志。 默认行为为 false。

searchText

string

搜索文本。

PackageSearchResponseContent

定义为包搜索请求返回的响应项。

名称 类型 说明
count

integer

匹配包的总数。

facets

object

一个字典,该字典针对每个方面存储对象的数组 Filter

infoCode

integer

指示任何其他信息的数字代码:0 - 正常,1 - 帐户正在重新编制索引,2 - 帐户索引尚未启动,3 - 请求无效,4 - 不支持前缀通配符查询,5 - 不支持代码方面的多字,6 - 正在载入帐户,7 - 正在加入帐户或重新编制索引,8 - 已剪裁为允许的最大值 9 - 正在为分支编制索引, 10 - 未启用分面,11 - 工作项不可访问,19 - 不支持代码类型筛选器的短语查询,20 - 不支持具有代码类型筛选器的通配符查询。 任何其他信息代码都用于内部目的。

results

PackageResult[]

匹配包的列表。

SortOption

定义如何对结果进行排序。

名称 类型 说明
field

string

应对其执行排序的字段名称。

sortOrder

string

对结果排序 (ASC/DESC) 排序。