XML format of response to a text search query
In response to a text search query, Yandex Search API can return a UTF-8
Alert
You can get a maximum of 1,000 search results per search query. Depending on the docs-in-group attribute value, each result may contain one to three documents. The maximum number of search results pages depends on the number of groups of documents per page, which is defined by the groups-on-page attribute. For example, if the groups-on-page
attribute is set to 10
, a maximum of 100 pages with search results can be generated.
Files consist of grouping tags such as request (aggregate information on search query parameters) and response (search query handling results).
Below is the general structure of the resulting XML document with examples of values.
Warning
This structure is provided for information purposes only and contains mutually exclusive elements.
Response structure
<?xml version="1.0" encoding="utf-8"?>
<yandexsearch version="1.0">
<request>
<query>yandex</query>
<page>0</page>
<sortby order="descending" priority="no">rlv</sortby>
<maxpassages>2</maxpassages>
<groupings>
<groupby attr="d" mode="deep" groups-on-page="10" docs-in-group="3" curcateg="-1" />
</groupings>
</request>
<response date="20120928T103130">
<error code="15">No results found for your word combination</error>
<reqid>1348828873568466-1289158387737177180255457-3-011-XML</reqid>
<found priority="phrase">206775197</found>
<found priority="strict">206775197</found>
<found priority="all">206775197</found>
<found-human>207 million results found</found-human>
<misspell>
<rule>Misspell</rule>
<source-text>yande<hlword>xx</hlword></source-text>
<text>yandex</text>
</misspell>
<reask>
<rule>Misspell</rule>
<source-text><hlword>yn</hlword>dex</source-text>
<text-to-show>yandex</text-to-show>
<text>yandex</text>
</reask>
<results>
<grouping attr="d" mode="deep" groups-on-page="10" docs-in-group="3" curcateg="-1">
<found priority="phrase">45094</found>
<found priority="strict">45094</found>
<found priority="all">45094</found>
<found-docs priority="phrase">192685602</found-docs>
<found-docs priority="strict">192685602</found-docs>
<found-docs priority="all">192685602</found-docs>
<found-human>193 million results found</found-human>
<page first="1" last="10">0</page>
<group>
<categ attr="d" name="UngroupVital223.ru" />
<doccount>34</doccount>
<relevance priority="all" />
<doc id="ZD831E1113BCFDD95">
<relevance priority="phrase" />
<url>https://www.yandex.ru/</url>
<domain>www.yandex.ru</domain>
<title><hlword>Yandex</hlword>: search engine and internet portal</title>
<headline>Internet-wide search based on the user's region.</headline>
<modtime>20060814T040000</modtime>
<size>26938</size>
<charset>utf-8</charset>
<passages>
<passage><hlword>Yandex</hlword> is a search engine responding to your query with...</passage>
</passages>
<properties>
<_PassagesType>0</_PassagesType>
<lang>ru</lang>
</properties>
<mime-type>text/html</mime-type>
<saved-copy-url>https://hghltd.yandex.net/yandbtm?text=yandex&url=https%3A%2F%2Fwww.yandex.ru%2F&fmode=inject&mime=html&l10n=ru&sign=e3737561fc3d1105967d1ce6********&keyno=0</saved-copy-url>
</doc>
</group>
</grouping>
</results>
</response>
</yandexsearch>
Response parameters
The request
group provides aggregate information about request parameters. It may be missing if there are errors in the response.
request
Request group tags |
Description |
Attributes |
query |
Search query text |
None |
page |
Number of returned search results page. Page numbering starts from zero ( |
None |
sortby |
Result sorting parameters. The possible values are:
|
|
maxpassages |
Maximum number of passages per search result. |
None |
groupings |
Grouping tag It contains grouping parameters in the |
None |
groupby |
Parameters for grouping the search results. |
|
The example below shows the contents of the request
grouping tag returned in response to a query:
https://yandex.com.tr/search/xml?l10n=en&user=xml-search-user&key=03.79031114:b631r9j587dkl4jko987hgg7********&query=%22has%20sample%20applications%20for%20the%20most%20popular%20programming%22&sortby=tm&maxpassages=2&groupby=attr%3Dd.mode%3Ddeep.groups-on-page%3D5.docs-in-group%3D3&maxpassages=3&page=1
<request>
<query>"has sample applications for the most popular programming"</query>
<page>1</page>
<sortby order="descending" priority="no">tm</sortby>
<maxpassages>2</maxpassages>
<groupings>
<groupby attr="d" mode="deep" groups-on-page="5" docs-in-group="3" curcateg="-1"/>
</groupings>
</request>
response
This group has the results of handling the search query, the information on which is provided in the request child tags.
It contains the date
attribute with the query date and time (UTC) in <year><month><day>T<hour><minute><second>
format.
This group consists of the following sections:
General search results info
The table below lists the tags of the general search results info section.
General search results info tags |
Description |
Attributes |
error |
Error description Used only if a search query is handled incorrectly (e.g., if the query is empty or parameters are incorrect). In some cases, it is mutually exclusive with other tags of the |
|
reqid |
Unique query ID |
None |
found |
Estimated number of documents found for the query. |
|
found-human |
String in the language according to the selected search type. It shows the number of found documents and contains related information. |
None |
misspell / reask
section
Optional. It is present if a typo is detected (misspell
) or fixed (reask
) in the query.
The table below lists the tags for this section.
|
Description |
Attributes |
misspell |
This is a grouping tag. It contains information about a possible typo in the search query. |
None |
reask |
This is a grouping tag. It contains information about a fix made in the original query before searching for documents. |
None |
rule |
Type of error found in the query. The possible values are:
|
None |
source-text |
Source query text. The search query fragment presumably containing an error is highlighted with the |
None |
text-to-show |
Optional (only for the Contains the fixed search query text. In most cases, it matches the value provided in the text tag. |
None |
text |
Fixed search query text. |
None |
results
section
Optional. It is present if results are found for the query.
The table below lists the tags for this section.
|
Description |
Attributes |
results |
This is a grouping tag. Child tags contain information about search parameters and found documents. |
None |
grouping |
This is a grouping tag. Child tags contain information about search parameters and found documents. |
Attributes reflect the grouping rules for documents.
|
found |
Estimated number of generated groups. |
|
found-docs |
Estimated number of documents found for the query. It is a more accurate estimate compared to the value provided in the |
|
found-docs-human |
A string in the language matching the selected search type. It shows the number of found documents and contains related information. The value being provided must be used when generating search results. |
None |
page |
Number of returned search results page. Page numbering starts from zero ( |
|
group |
This is a grouping tag. Each |
None |
categ |
Identification data of the group of found documents. |
|
doccount |
Estimated number of documents used to create the group. Documents that qualify for inclusion in the group are ranked based on the query criteria provided in the |
None |
relevance |
This is a service tag. |
|
doc |
This is a grouping tag. Each Depending on the docs-in-group parameter value, each group can contain from one to three |
|
url |
URL of the found document. |
None |
domain |
Domain hosting the found document. |
None |
title |
Title of the found document. Words included in the search query are highlighted with the |
None |
headline |
Optional. Document annotation. It is generated using the |
None |
modtime |
Document update date and time in the following format:
Warning This tag is optional and may be missing in some cases. |
None |
size |
Size of the found document, in bytes. |
None |
charset |
Encoding of the found document. |
None |
passages |
Grouping tag with a list of document's passages. |
None |
passage |
Passage with annotation to the document. Words included in the search query are highlighted with the The maximum number of passages provided in a single |
None |
mime-type |
Document type according to RFC2046 |
None |
properties |
Grouping tag with document properties. |
None |
_PassagesType |
Passage type. The possible values are:
|
None |
lang |
Optional. It determines the document language. |
None |
saved-copy-url |
URL of the saved document copy. |
None |