Search Documents

Returns the result for a given query.

Resource Information

This service uses the tomcat application on port 8080 by default. To see a list of default ports click here

The context for this API is /crafter-search, please prefix the API URLs with this context.

HTTP Verb
GET
URL
/api/2/search
Response Formats
JSON

Parameters

Name
Type
Required
Description
index_id
String

The index ID
token
String
The access token.

The access token could be optional depending on the configuration.

Solr Query Parameters

Note

This table includes the most often used parameters, but the request may include any valid Solr parameter.

Name
Description
q
Main query to search documents, must follow Solr syntax
fq
Additional filter queries, must follow Solr syntax
fl
List of fields to return for the matched documents
hl
Enable text highlight
hl.fl
List of fields to apply text highlight
hl.snippets
Maximum number of highlighted snippets for each field
hl.fragsize
Approximate number of characters to include in each snippet
start
Offset for the list of matched documents
rows
Number of matched documents to return

Example

Request

GET .../api/2/search/search?index_id=editorial&q=*&fq=content-type%3A%22page%2Farticle%22&rows=2&fl=localId&token=myAccessToken

Response

Status 200 OK

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{
"responseHeader": {
  "status": 0,
  "QTime": 1,
  "params": {
    "q": "*",
    "fl": "localId",
    "fq": [
      "content-type:\"page/article\"",
      "-disabled:\"true\"",
      "-expired_dt:[* TO NOW]"
    ],
    "index_id": "editorial",
    "rows": "2",
    "wt": "javabin",
    "version": "2"
  }
},
"response": {
  "start": 0,
  "maxScore": null,
  "numFound": 9,
  "documents": [
    {
      "localId": "/site/website/articles/2017/1/men-styles-for-winter/index.xml"
    },
    {
      "localId": "/site/website/articles/2017/1/women-styles-for-winter/index.xml"
    }
  ]
}
}

Responses

Status
Location
Response Body
200
.../api/2/search/search
See example above.
500

{ "message" : "Internal server error" }
503

{ "message" : "Service unavailable, please try again later" }