XML results format
The Search/Select API returns its results using the XML format. Here is an example, alternating the explanations with the content of an example XML result (in boxes).
First, the file provides the usual statements. It is encoded using the UTF-8 charset.
<?xml version="1.0" encoding="UTF-8"?> <response>
Within the header part you will find the following information:
- status is a 0 if everything went right. If there was a problem, there will be a non-zero error code.
- query: the developed form of the search query
<header> <status>0</status> <query>title:search^10.0 title:search^10.0 titleExact:search^10.0 titleExact:search^10.0 url:search^5.0 url:search^5.0 urlSplit:search^5.0 urlSplit:search^5.0 urlExact:search^5.0 urlExact:search^5.0 content:search content:search contentExact:search contentExact:search</query> </header>
Within the result part you will find the following information:
- name: is always "response".
- numFound: indicates the number of found documents
- collapsedDocCount: indicates the number of documents that have been collapsed
- start: rank of the first result
- rows: number of results
- maxScore: score achieved by the most relevant document in the lot
- time: duration of the query, in milliseconds
<result name="response" numFound="48" collapsedDocCount="8" start="0" rows="10" maxScore="1.0383902" time="5">
A doc part is filled for each document providing results:
- score: score of the documents relative to the words being searched for
- pos: ranking of the document among the documents within which results were found.
<doc score="1.0383902" pos="0"> <field name="url">http://www.open-search-server.com/</field> <snippet name="title" highlighted="yes">Open <b>Search</b> Server - Open source <b>search</b> engine</snippet> <snippet name="content" highlighted="yes">Open <b>Search</b> Server (OSS)...Community...Services...About us...Project... Download...Forums...Wiki...Documentation...Trackers...Mailing lists...Open <b>Search</b> Server - Open source <b>search</b>... </snippet> </doc>
For each "returned" element in the query, a field is provided, with the content of the fields. As can be surmised, name indicates the name of the field.
For each snippet requested in the query, a 'snippet element is provided, with an excerpt from the content. Again, the name attribute is the name of the field.
collapseCount indicates how many documents have been collapsed.
<doc score="1.0383902" pos="1"> <field name="url">http://www.open-search-server.com/home</field> <snippet name="title" highlighted="yes">Open <b>Search</b> Server - Open source <b>search</b> engine</snippet> <snippet name="content" highlighted="yes">Open <b>Search</b> Server (OSS)...Community...Services...About us... Project...Download...Forums...Wiki...Documentation...Trackers...Mailing lists...Open <b>Search</b> Server - Open source <b>search</b>... </snippet> <collapseCount>1</collapseCount> </doc> </result>
The faceting element provides the list of facets which were requested. For each facet, a field element is provided, with the list of requested facets and the number of occurrences.
<faceting> <field name="host"> <facet name="www.open-search-server.com">24</facet> <facet name="www.open-search-server.fr">24</facet> </field> </faceting>
The spellcheck elements provides the list of requested spellchecks. For each spellcheck, a 'field' element is provided. For each word in the query, a word element is provided, with a list of suggested words.
<spellcheck> <field name="contentExact"> <word name="search"> <suggest>seach</suggest> <suggest>years</suggest> </word> </field> </spellcheck> </response>