From 5a1087dbf9a82e8eb8e77d4b38de498c1259db11 Mon Sep 17 00:00:00 2001 From: Viktor Lofgren Date: Mon, 12 Feb 2024 16:13:48 +0100 Subject: [PATCH] (qs-gui) Update documentation, add param for domain limit --- .../marginalia/query/model/QueryParams.java | 2 -- .../marginalia/query/QueryBasicInterface.java | 3 +- .../main/resources/static/public/index.html | 31 +++++++++++++++++-- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/code/api/query-api/src/main/java/nu/marginalia/query/model/QueryParams.java b/code/api/query-api/src/main/java/nu/marginalia/query/model/QueryParams.java index 9d83e117..35ca1828 100644 --- a/code/api/query-api/src/main/java/nu/marginalia/query/model/QueryParams.java +++ b/code/api/query-api/src/main/java/nu/marginalia/query/model/QueryParams.java @@ -1,7 +1,5 @@ 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.SpecificationLimit; diff --git a/code/services-core/query-service/src/main/java/nu/marginalia/query/QueryBasicInterface.java b/code/services-core/query-service/src/main/java/nu/marginalia/query/QueryBasicInterface.java index 15da22bd..6558f1b8 100644 --- a/code/services-core/query-service/src/main/java/nu/marginalia/query/QueryBasicInterface.java +++ b/code/services-core/query-service/src/main/java/nu/marginalia/query/QueryBasicInterface.java @@ -44,10 +44,11 @@ public class QueryBasicInterface { } 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"); var query = queryFactory.createQuery(new QueryParams(queryParam, new QueryLimits( - 1, count, 250, 8192 + domainCount, count, 250, 8192 ), set)); var rsp = indexClient.query( diff --git a/code/services-core/query-service/src/main/resources/static/public/index.html b/code/services-core/query-service/src/main/resources/static/public/index.html index 7fb19c9d..f74e58cc 100644 --- a/code/services-core/query-service/src/main/resources/static/public/index.html +++ b/code/services-core/query-service/src/main/resources/static/public/index.html @@ -27,12 +27,39 @@ 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

-

Minimal integration with the API:

+

+ The following query parameters are available: +

+ + + + + + + + + + + + + + + + + + + + + +
ParameterDescription
qThe query to perform.
countLimit the number of results returned. Default is 10.
domainCountMax number of results per domain
setRanking Set (documentation)
+ +

Minimal integration with the API:

Curl
- $ curl -H 'Accept: application/json' 'http://localhost:8080/search?q=test' + $ curl -H 'Accept: application/json' 'http://localhost:8080/search?q=test&count=20'
Python 3