(qs-gui) Update documentation, add param for domain limit

This commit is contained in:
Viktor Lofgren 2024-02-12 16:13:48 +01:00
parent 7564dfeb7a
commit 5a1087dbf9
3 changed files with 31 additions and 5 deletions

View File

@ -1,7 +1,5 @@
package nu.marginalia.query.model; package nu.marginalia.query.model;
import nu.marginalia.index.client.model.query.SearchSetIdentifier;
import nu.marginalia.index.client.model.query.SearchSpecification;
import nu.marginalia.index.query.limit.QueryLimits; import nu.marginalia.index.query.limit.QueryLimits;
import nu.marginalia.index.query.limit.SpecificationLimit; import nu.marginalia.index.query.limit.SpecificationLimit;

View File

@ -44,10 +44,11 @@ public class QueryBasicInterface {
} }
int count = request.queryParams("count") == null ? 10 : Integer.parseInt(request.queryParams("count")); int count = request.queryParams("count") == null ? 10 : Integer.parseInt(request.queryParams("count"));
int domainCount = request.queryParams("domainCount") == null ? 5 : Integer.parseInt(request.queryParams("domainCount"));
String set = request.queryParams("set") == null ? "" : request.queryParams("set"); String set = request.queryParams("set") == null ? "" : request.queryParams("set");
var query = queryFactory.createQuery(new QueryParams(queryParam, new QueryLimits( var query = queryFactory.createQuery(new QueryParams(queryParam, new QueryLimits(
1, count, 250, 8192 domainCount, count, 250, 8192
), set)); ), set));
var rsp = indexClient.query( var rsp = indexClient.query(

View File

@ -27,12 +27,39 @@
The same endpoint is available as a web API with JSON-results when the The same endpoint is available as a web API with JSON-results when the
'Accept: application/json'-header is sent by the client.</p> 'Accept: application/json'-header is sent by the client.</p>
<h3 class="my-3">Query parameters</h3>
<h3>Minimal integration with the API:</h3> <p>
The following query parameters are available:
</p>
<table>
<tr>
<th>Parameter</th><th>Description</th>
</tr>
<tr>
<td><code>q</code></td>
<td>The query to perform.</td>
</tr>
<tr>
<td><code>count</code></td>
<td>Limit the number of results returned. Default is 10.</td>
</tr>
<tr>
<td><code>domainCount</code></td>
<td>Max number of results per domain</td>
</tr>
<tr>
<td><code>set</code></td>
<td>Ranking Set (<a href="https://docs.marginalia.nu/3_configuration_options/3_ranking_sets/">documentation</a>)</td>
</tr>
</table>
<h3 class="my-3">Minimal integration with the API:</h3>
<dl> <dl>
<dt>Curl</dt> <dt>Curl</dt>
<dd> <dd>
<code>$ curl -H 'Accept: application/json' 'http://localhost:8080/search?q=test'</code> <code>$ curl -H 'Accept: application/json' 'http://localhost:8080/search?q=test&count=20'</code>
</dd> </dd>
<dt> <dt>
Python 3 Python 3