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