# Marginalia Query Service

This is the barebones search interface for the Marginalia Search Engine software.

If you are seeing this somewhere other than your own machine, someone has likely misconfigured something.

## Control GUI

If this is running on your own machine, you can also use the control interface, which is by default available on http://localhost:8081/.

## API

There is not much here, except the /search endpoint offers a very web interface for performing queries. The same endpoint also responds with JSON if the `Accept`-header is provided.

The HTML version of this interface exists for demonstration purposes only. The same endpoint is available as a web API with JSON-results when the 'Accept: application/json'-header is sent by the client.

### Query parameters

The following query parameters are available:

Parameter | Description
--- | ---
`q` | The query to perform.
`count` | Limit the number of results returned. Default is 10.
`domainCount` | Max number of results per domain
`set` | Ranking Set (documentation)

### Minimal integration with the API:

Curl
  `$ curl -H 'Accept: application/json' 'http://localhost:8080/search?q=test&count=20'`
Python 3
  `#!/bin/env python3 import requests import json r = requests.get('http://localhost:8080/search?q=test', headers={'Accept': 'application/json'}) print(json.dumps(r.json(), indent=4))`

Remember to URLencode the query!