Skip to content

Conversation

@brunoocasali
Copy link
Member

@brunoocasali brunoocasali commented Aug 15, 2022

This branch will not be merged until the team defines the fate of the finite pagination, you can read more here.

⚠️ This code can change in the future, and it is not protected by tags, be careful.

Installing:

composer require meilisearch/meilisearch-php:"dev-meilisearch-finite-pagination-beta as v0.24.3.beta"

Searching:

Basic search now responds directly with the new pagination.

$results = client->search("botman"); // SearchResult

{
  "hits":[…],
  "query":"botman",
  "processingTimeMs":5,
  "hitsPerPage":20,
  "page":1,
  "totalPages":4,
  "totalHits": 52
}

You can request a specific search results page using the page search parameter. Defaults to 1.

$results = client->search("botman", ["page" => 2]);

You can also set the max number of hits per page. Defaults to 20.

$results = client->search("botman", ["hitsPerPage" => 15]);

To disable exhaustive pagination, your query must include either limit or offset. Meilisearch will return estimatedTotalHits instead of hitsPerPage, page, totalPages, and totalHits.

$results = client->search("botman", ["offset" => 0]); // SearchResult

{
  "hits":[…],
  "query":"botman",
  "processingTimeMs":3,
  "limit":20,
  "offset":0,
  "estimatedTotalHits":66
}

⚠️ ⚠️ 🎉 🎉
Any suggestion related to PHP implementation can be made here, but anything related to Meilisearch's public API should be done in the appropriate discussion.

@brunoocasali brunoocasali marked this pull request as draft August 15, 2022 20:38
@brunoocasali brunoocasali force-pushed the meilisearch-finite-pagination-beta branch from e545ce7 to f6980f7 Compare August 17, 2022 17:31
@brunoocasali brunoocasali force-pushed the meilisearch-finite-pagination-beta branch from f6980f7 to 4a465ca Compare August 17, 2022 18:59
@brunoocasali brunoocasali force-pushed the meilisearch-finite-pagination-beta branch 2 times, most recently from a2637c9 to 9ff489c Compare August 17, 2022 19:42
@brunoocasali brunoocasali force-pushed the meilisearch-finite-pagination-beta branch from 9ff489c to 0c13834 Compare August 17, 2022 19:43
@brunoocasali brunoocasali requested review from alallema and bidoubiwa and removed request for bidoubiwa August 17, 2022 19:49
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
# Will still run for each push to bump-meilisearch-v*
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
if: (endsWith(github.base_ref, '-beta') && (github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand the logic here.

Are you requiring that the branch ends with -beta in order for the normal tests to run?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouln't it be this:

    if: (!endsWith(github.base_ref, '-beta') || github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v'))

?

@brunoocasali
Copy link
Member Author

Closing it since it was added in v0.26.0

@curquiza curquiza deleted the meilisearch-finite-pagination-beta branch October 26, 2023 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants