Struggling with pagination within search/query.json

I’m trying to grab the posts within a date interval from our discourse server using the API. I’m struggling quite a lot with pagination.

Firstly I tried using search.json but that limits us to 50 results:
https://meta.discourse.org/search.json?q=after:2016-01-01%20before:2017-01-01

I tried to use the paginated query instead (but page 2 and page 3 end up the same for some queries):
https://meta.discourse.org/search/query.json?term=after:2016-01-01%20before:2017-01-01
https://meta.discourse.org/search/query.json?term=after:2016-01-01%20before:2017-01-01?page=2
https://meta.discourse.org/search/query.json?term=after:2016-01-01%20before:2017-01-01?page=3

That’s odd because simpler queries appear to paginate correctly:
https://meta.discourse.org/search/query.json?term=API
https://meta.discourse.org/search/query.json?term=API?page=2
https://meta.discourse.org/search/query.json?term=API?page=3
https://meta.discourse.org/search/query.json?term=API?page=51 (more_pages becomes null here, although we can fetch higher pages)

Is is possible to combine advanced search and pagination?

Second (3rd, 4th, etc.,) query string should look like below. & symbol instead of ?

https://meta.discourse.org/search/query.json?term=after:2016-01-01%20before:2017-01-01&page=2
https://meta.discourse.org/search/query.json?term=API&page=2

not like this

https://meta.discourse.org/search/query.json?term=after:2016-01-01%20before:2017-01-01?page=2
https://meta.discourse.org/search/query.json?term=API?page=2

I don’t know if it’ll help, but I wrote a little ruby program that will download all of a topic or category. (It doesn’t pay attention to dates, though.)

Oops. Getting the links wrong is what made me believe discourse support pagination using page=X in the first place (my own bad conversion from curl to a web browser).

Perhaps I should have ask a more general question: If search/query.json has a grouped_search_result with more_posts set true, how do I get to see the additional posts?

I know this is quite late, but yes we certainly support pagination now, search for something with lots of results and then use:

Reverse engineer the Discourse API

To find all the endpoints.

Discourse API 사용법을 이해하려고 하고 있습니다.
아래 URL에서 term은 기간이나 시간 범위를 가리키는 것으로 추측하고 있습니다. 이는 erm=after:2016-01-01%20before:2017-01-01 등의 파라미터를 근거로 한 것입니다. 하지만 term=API가 무엇을 가리키는지 명확하지 않습니다. 누군가 설명해 주실 수 있을까요?

실제로 /search.json?q=와 /search/query?term=라는 두 가지 검색 엔드포인트를 사용할 수 있습니다.

term은 단순히 검색어를 의미하며, 기간이나 지속 시간을 가리키는 것이 아닙니다.

검색 API를 이해하려면 https://meta.discourse.org/t/how-to-reverse-engineer-the-discourse-api/20576을 참고하고, API를 통해 수행하려는 검색을 UI에서 직접 실행해 보신 후 UI가 동일한 API 요청을 어떻게 보내는지 확인해 보시는 것이 가장 좋습니다.

hi @blake,
답변해 주셔서 감사합니다.

실제로 저는 페이지의 전체 내용을 가져오기를 원합니다(제 경우 카테고리 내 주제 목록, Obtaining a list of topics from a category 참조). 필요하지 않다면 페이지별로 진행하는 것은 원하지 않습니다. 또한 Discourse는 스크롤할 때 페이지를 확장하는 방식이라 역공학으로 이를 해결하기는 어려울 것 같습니다. 제 지식 범위 내에서는 전체 페이지를 한 번에 표시하는 옵션이 없습니다. 이를 수행할 수 있는 방법이 있을까요?

특정 카테고리의 모든 주제를 가져오는 단일 API 호출은 없습니다. 여러 번의 API 호출을 수행해야 합니다. 이는 한 카테고리에 100만 개 이상의 주제가 있을 수 있으며, 그렇게 하면 쿼리가 매우 커져 사이트 성능에 영향을 미칠 수 있기 때문입니다. 스크롤 동작을 역추적하면 Discourse UI가 추가 주제를 가져오기 위해 API 호출을 하는 방식을 확인할 수 있으며, 이를 통해 해당 동작을 자신의 API에서 재현할 수 있습니다.

목표에 따라 데이터 탐색(data explore) 쿼리를 사용하여 카테고리 내 주제 수를 조회하고, 저장된 해당 쿼리에 대해 API 호출을 수행하는 방법도 사용할 수 있습니다.