Skip to main content

site/search (GET) (MT4)


Search the site index

  • REST Method: GET
  • Method Access: public

Query Parameters

Name Type Description
parser {bestguess|term|filename|lucene}? The parser to use for the query (default: bestguess)
nocache bool? Use caching search path (better for paging results) (default: false)
authenticate bool? Force authentication for request (default: false)
constraint string? Additional search constraints (ex: language:en-us AND type:wiki) default: none
sortby {score, title, date, size, wordcount, rating.score, rating.count}? Sort field. Prefix value with '-' to sort descending. default: -score
offset int? Number of items to skip. Must be a positive number or 0 to not skip any. (default: 0)
limit string? Maximum number of items to retrieve. Must be a positive number or 'all' to retrieve all items. (default: 100)
verbose bool? show verbose page xml. default: true
format {xml | search}? search output format (xml | search) default: xml
q string lucene search string

Return Codes

Name Value Description
OK 200 The request completed successfully
Bad Request 400 Invalid input parameter or request body

Message Format

Output (XML):

    <page id="{int}" href="{uri}" score="{float}">
    <file id="{int}" href="{uri}" score="{float}">

Output (search):


Implementation Notes

Refer here for more information on the Lucene search string format.

C# Code Sample: Perform a Search

The following code example searches for pages with the title "Subpage 1":

Sample Code

Plug p = Plug.New("http://deki-hayes/@api/deki");
p.At("users", "authenticate").WithCredentials("admin", "password").Get();
p.At("site", "search").With("q", "title:\"Subpage 1\"").With("format", "xml").Get();

Sample Response from executing Code

Sample response indicating that one page was found:

        <title>Subpage 1</title> 
        <mime /> 
        <id.file /> 
        <tag /> 
        <description /> 

Implementation notes 

Add notes about requirements or config values

Curl Code Sample: Perform a Search

The following command performs a search of the site for the string value of parameter "q":

Sample Code

curl -u username:password -i http://mindtouch.address/@api/deki/site/search?q=xxx

Sample Response from executing Code

Result for a search string present in one page

Content-Type: application/xml

  <parsedQuery>content:kyle title:kyle^4.0 path.title:kyle^4.0 description:kyle^3.0 tag:kyle^2.0 comments:kyle -namespace:template -namespace:template_talk -namespace:help -namespace:help_talk</parsedQuery>
  <page id="603" href="" revision="2" score="0.2008925">
    <title>test feed</title>
    <summary><p>kyle kenny stan cartman</p></summary>
    <security href="">
        <operations mask="15">LOGIN,BROWSE,READ,SUBSCRIBE</operations>
        <operations mask="0"/>
    < id="1" href="">
      <email hidden="true"/>
    <description>4 words added, 13 words removed</description>
    <page.parent id="21" href="">
      <title>Best Wiki Ever</title>
    <subpages href=""/>
    <outbound count="0"/>
    <inbound count="0"/>
    <aliases href=""/>
    <revisions count="2" href=""/>
    <comments count=" 0" href=""/>
    <properties count="0" href="">
      <language deprecated="true"/>
    <tags count="0" href=""/>
    <files count="0"/>
    <contents type="application/x.deki0805+xml" href=""/>
    <contents.alt type="application/pdf" href=""/>

Implementation notes 

curl flags

Provides external user authentication. Note that if anonymous access is available and authentication is not forced, this flag may be omitted.
Outputs the HTTP response headers. Useful for debugging.
  • Was this article helpful?