Search code examples
paginationsphinx

How to force Sphinx to output the first page if there's only one page, but the second page is chosen


I use sphinxapi.php.
I want to use pagination in my script.

My query returns 5 matches.
Page size is 10 items.
URL contains parameter PAGE=2, so the second page is chosen.
But as far as we have only one page of results, I want sphinx to output it. No matter what page is given in URL.

I can do it with two queries. Is it realizable in one query?

Thanks.


Solution

  • I dont think it is, it's sort of chicken and egg thing. Nobody knows the query is going to 'fail' until try it. All can do is then rerun a different query.