Search API
Fetching Search Results
You can retrieve search results from Fess in JSON format by sending a request to http://<Server Name>/api/v1/documents?q=search term
. To use the search API, you need to enable JSON responses in the Administration screen under “General Settings.”
Request Parameters
You can specify request parameters to perform advanced searches, such as http://<Server Name>/api/v1/documents?q=search term&num=50&fields.label=fess
. The available request parameters are as follows:
q | The search term. Encode it in the url. |
start | The starting position of the search results. It starts from 0. |
num | The number of results to display. The default is 20, and you can display up to 100. |
sort | Sorting. Used to sort the search results. |
fields.label | Label value. Used to specify a label. |
facet.field | Specify a facet field. (e.g., facet.field=label ) |
facet.query | Specify a facet query. (e.g., facet.query=timestamp:[now/d-1d TO *] ) |
facet.size | Specify the maximum number of facets to retrieve. This is valid when facet.field is specified. |
facet.minDocCount | Retrieve facets with a count equal to or greater than this value. This is valid when facet.field is specified. |
geo.location.point | Specify latitude and longitude. (e.g., geo.location.point=35.0,139.0 ) |
geo.location.distance | Specify the distance from the center point. (e.g., geo.location.distance=10km ) |
lang | Specify the search language. (e.g., lang=en ) |
preference | Specify a string to determine the shard to use during search. (e.g., preference=abc ) |
callback | The callback name when using JSONP. It is not necessary to specify if JSONP is not used. |
Table: Request Parameters
Response
{
"q": "Fess",
"query_id": "bd60f9579a494dfd8c03db7c8aa905b0",
"exec_time": 0.21,
"query_time": 0,
"page_size": 20,
"page_number": 1,
"record_count": 31625,
"page_count": 1,
"highlight_params": "&hq=n2sm&hq=Fess",
"next_page": true,
"prev_page": false,
"start_record_number": 1,
"end_record_number": 20,
"page_numbers": [
"1",
"2",
"3",
"4",
"5"
],
"partial": false,
"search_query": "(Fess OR n2sm)",
"requested_time": 1507822131845,
"related_query": [
"aaa"
],
"related_contents": [],
"data": [
{
"filetype": "html",
"title": "Open Source Enterprise Search Server: Fess — Fess 11.0 documentation",
"content_title": "Open Source Enterprise Search Server: Fess — Fe...",
"digest": "Docs » Open Source Enterprise Search Server: Fess Commercial Support Open Source Enterprise Search Server: Fess What is Fess? Fess is a powerful and easily deployable Enterprise Search Server. ...",
"host": "fess.codelibs.org",
"last_modified": "2017-10-09T22:28:56.000Z",
"content_length": "29624",
"timestamp": "2017-10-09T22:28:56.000Z",
"url_link": "https://fess.codelibs.org/",
"created": "2017-10-10T15:00:48.609Z",
"site_path": "fess.codelibs.org/",
"doc_id": "e79fbfdfb09d4bffb58ec230c68f6f7e",
"url": "https://fess.codelibs.org/",
"content_description": "Enterprise Search Server: Fess Commercial Support Open...Search Server: Fess What is Fess? Fess is a very powerful...You can quickly install and run Fess on any platform...Fess is provided under the Apache license...Apache license. Demo Fess is an Elasticsearch-based search",
"site": "fess.codelibs.org/",
"boost": "10.0",
"mimetype": "text/html"
}
]
}
The response will be as follows:
Searching All Documents
To search all documents, send the following request: http://<Server Name>/api/v1/documents/all?q=search_term`
To use this feature, you need to set api.search.scroll
to true in the fess_config.properties
file.
Request Parameters
The available request parameters are as follows:
q | Search term. Pass it after url encoding. |
num | Number of items to display. The default value is 20, and you can display up to 100 items. |
sort | Sort order. Used to sort the search results. |
Table: Request Parameters