-
-
Notifications
You must be signed in to change notification settings - Fork 1
Search
The /search endpoint is a critical component of the SearQ.org API, as it is the primary means by which users can search for information within the SearQ database. The endpoint is designed to provide a flexible, powerful, and efficient search experience, allowing users to find the information they need quickly and easily.
curl -G -H "Authorization: Token {TOKEN}" https://<URL>/api/search.json -d "q={q}"
At its core, the /search endpoint is a RESTful API endpoint that accepts HTTP GET requests. The endpoint takes several parameters that allow users to customize their search query, including:
-
q: The search query string. This parameter is required and should contain the user's search terms.
-
limit: The maximum number of results to return. This parameter is optional and can be used to limit the number of results returned by the search query. [default 1000]
-
sort: The field to sort the results by. This parameter is optional and can be used to sort the search results based on a specific field, such as relevance or date. The available options for the sort parameter may vary depending on the SearQ database configuration. [default published_at]
-
direction: The direction in which to sort the results. This parameter is optional and can be used to specify whether the search results should be sorted in ascending or descending order based on the specified sort field.
The search results returned by the /search endpoint are in JSON format, providing a flexible and easy-to-parse data structure for integration with other applications. Each result includes a title, a snippet of text containing the search terms, and a URL linking to the original source of the information. [default desc]
The /search endpoint of the SearQ.org API supports pagination, which means that the results of a search query are split into separate "pages" or "chunks" of data that can be retrieved individually. This helps to improve the performance and efficiency of the API by limiting the amount of data that needs to be processed and transmitted at any given time.
curl -G -H "Authorization: Token {TOKEN}" https://<URL>/api/search.json -d "q={q}&page={page}"
The page parameter specifies the page number of the results to return, with each page containing a fixed number of results specified by the limit parameter.
In summary, the /search endpoint is the core of the SearQ.org API, providing users with a powerful and flexible search experience for finding information within the SearQ database. By accepting a range of parameters and returning results in a structured, standardized format, the endpoint allows users to easily integrate SearQ search functionality into their own applications.