thesaurus-linguae-aegyptiae / tla-es

Thesaurus Linguae Aegyptiae Spring backend for Elasticsearch access
1 stars 4 forks source link

fix page size handling in search #85

Closed JKatzwinkel closed 1 year ago

JKatzwinkel commented 1 year ago

search endpoints such as /sentence/search currently only support the default page size of 20 results at once because the actual page size as specified via the &size URL parameter in requests isn't taken into account during calculation of the pagination information of the results. These changes fix that issue by handling the &size parameter so that it can be used to specify the desired number of results per page.

It is therefore possible to request a certain amount of search results per page in a search request like this:

curl -X POST -H "Content-Type: application/json" "http://localhost:8090/sentence/search?size=10" -d @q-occ-lemma.json

...or, in a more simple manner (using HTTPie):

http post :8090/sentence/search size==10 < q-occ-lemma.json

...assuming that there is a file q-occ-lemma.json with content such as e.g.:

{
    "@class": "tla.domain.command.SentenceSearch",
    "tokens": [
        {
            "lemma": {
                "id": "10050"
            }
        }
    ],
    "@dto": "tla.domain.dto.SentenceDto"
}

hope this helps.