Wiki Search Results - Fetch Wiki Search Results

Provides a set of results for the search request.

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

URI Parameters

Name In Required Type Description
organization
path True

string

The name of the Azure DevOps organization.

project
path

string

Project ID or project name

api-version
query True

string

Version of the API to use. This should be set to '7.1-preview.1' to use this version of the api.

Request Body

Name Type Description
$orderBy

SortOption[]

Options for sorting search results. If set to null, the results will be returned sorted by relevance. If more than one sort option is provided, the results are sorted in the order specified in the OrderBy.

$skip

integer

Number of results to be skipped.

$top

integer

Number of results to be returned.

filters

object

Filters to be applied. Set it to null if there are no filters to be applied.

includeFacets

boolean

Flag to opt for faceting in the result. Default behavior is false.

searchText

string

The search text.

Responses

Name Type Description
200 OK

WikiSearchResponse

successful operation

Security

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

Name Description
vso.wiki Grants the ability to read wikis, wiki pages and wiki attachments. Also grants the ability to search wiki pages.

Examples

Sample Request

POST https://almsearch.dev.azure.com/fabrikam/_apis/search/wikisearchresults?api-version=7.1-preview.1

{
  "searchText": "Hello",
  "$skip": 0,
  "$top": 2,
  "filters": {
    "Project": [
      "Search",
      "Release"
    ]
  },
  "$orderBy": null,
  "includeFacets": true
}

Sample Response

{
  "count": 1,
  "results": [
    {
      "fileName": "Hello-world.md",
      "path": "/Hello-world.md",
      "collection": {
        "name": "test"
      },
      "project": {
        "id": "9811862e-ec6f-4e94-93bd-91555b51eedd",
        "name": "Release",
        "visibility": null
      },
      "wiki": {
        "id": "9c2aeff2-bab0-43e9-9eaa-bf8283be064b",
        "mappedPath": "/",
        "name": "Release.wiki",
        "version": "wikiMaster"
      },
      "contentId": "70c379b63ffa0795fdbfbc128e5a2818397b7ef8",
      "hits": [
        {
          "fieldReferenceName": "fileNames",
          "highlights": [
            "<highlighthit>Hello</highlighthit>-world.md"
          ]
        },
        {
          "fieldReferenceName": "content",
          "highlights": [
            "<highlighthit>Hello</highlighthit> world"
          ]
        }
      ]
    }
  ],
  "infoCode": 0,
  "facets": {
    "Project": [
      {
        "name": "Search",
        "id": "Search",
        "resultCount": 0
      },
      {
        "name": "Release",
        "id": "Release",
        "resultCount": 1
      }
    ]
  }
}

Definitions

Name Description
Collection

Defines the details of the collection.

ProjectReference

Defines the details of the project.

SortOption

Defines how to sort the result.

Wiki

Defines the details of wiki.

WikiHit

Defines the matched terms in the field of the wiki result.

WikiResult

Defines the wiki result that matched a wiki search request.

WikiSearchRequest

Defines a wiki search request.

WikiSearchResponse

Defines a wiki search response item.

Collection

Defines the details of the collection.

Name Type Description
name

string

Name of the collection.

ProjectReference

Defines the details of the project.

Name Type Description
id

string

ID of the project.

name

string

Name of the project.

visibility

string

Visibility of the project.

SortOption

Defines how to sort the result.

Name Type Description
field

string

Field name on which sorting should be done.

sortOrder

string

Order (ASC/DESC) in which the results should be sorted.

Wiki

Defines the details of wiki.

Name Type Description
id

string

Id of the wiki.

mappedPath

string

Mapped path for the wiki.

name

string

Name of the wiki.

version

string

Version for wiki.

WikiHit

Defines the matched terms in the field of the wiki result.

Name Type Description
fieldReferenceName

string

Reference name of the highlighted field.

highlights

string[]

Matched/highlighted snippets of the field.

WikiResult

Defines the wiki result that matched a wiki search request.

Name Type Description
collection

Collection

Collection of the result file.

contentId

string

ContentId of the result file.

fileName

string

Name of the result file.

hits

WikiHit[]

Highlighted snippets of fields that match the search request. The list is sorted by relevance of the snippets.

path

string

Path at which result file is present.

project

ProjectReference

Project details of the wiki document.

wiki

Wiki

Wiki information for the result.

WikiSearchRequest

Defines a wiki search request.

Name Type Description
$orderBy

SortOption[]

Options for sorting search results. If set to null, the results will be returned sorted by relevance. If more than one sort option is provided, the results are sorted in the order specified in the OrderBy.

$skip

integer

Number of results to be skipped.

$top

integer

Number of results to be returned.

filters

object

Filters to be applied. Set it to null if there are no filters to be applied.

includeFacets

boolean

Flag to opt for faceting in the result. Default behavior is false.

searchText

string

The search text.

WikiSearchResponse

Defines a wiki search response item.

Name Type Description
count

integer

Total number of matched wiki documents.

facets

object

A dictionary storing an array of Filter object against each facet.

infoCode

integer

Numeric code indicating any additional information: 0 - Ok, 1 - Account is being reindexed, 2 - Account indexing has not started, 3 - Invalid Request, 4 - Prefix wildcard query not supported, 5 - MultiWords with code facet not supported, 6 - Account is being onboarded, 7 - Account is being onboarded or reindexed, 8 - Top value trimmed to maxresult allowed 9 - Branches are being indexed, 10 - Faceting not enabled, 11 - Work items not accessible, 19 - Phrase queries with code type filters not supported, 20 - Wildcard queries with code type filters not supported. Any other info code is used for internal purpose.

results

WikiResult[]

List of top matched wiki documents.