Search

class Tribler.Core.Modules.restapi.search_endpoint.SearchCompletionsEndpoint(session)[source]

This class is responsible for managing requests regarding the search completions terms of a query.

render_GET(request)[source]
GET /search/completions?q=(string: query)

A GET request to this endpoint will return autocompletion suggestions for the given query. For instance, when searching for “pioneer”, this endpoint might return “pioneer one” if that torrent is present in the local database. This endpoint can be used to suggest terms to users while they type their search query.

Example request:

curl -X GET http://localhost:8085/search/completions?q=pioneer

Example response:

{
    "completions": ["pioneer one", "pioneer movie"]
}
class Tribler.Core.Modules.restapi.search_endpoint.SearchEndpoint(session)[source]

This endpoint is responsible for searching in channels and torrents present in the local Tribler database. It also fires a remote search in the Dispersy communities.

render_GET(request)[source]
GET /search?q=(string: query)

A GET request to this endpoint will create a search. Results are returned over the events endpoint, one by one. First, the results available in the local database will be pushed. After that, incoming Dispersy results are pushed. The query to this endpoint is passed using the url, i.e. /search?q=pioneer.

Example request:

curl -X GET http://localhost:8085/search?q=tribler

Example response:

{
    "type": "search_result_channel",
    "query": "test",
    "result": {
        "id": 3,
        "dispersy_cid": "da69aaad39ccf468aba2ab9177d5f8d8160135e6",
        "name": "My fancy channel",
        "description": "A description of this fancy channel",
        "subscribed": True,
        "votes": 23,
        "torrents": 3,
        "spam": 5,
        "modified": 14598395,
        "can_edit": False
    }
}