Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
solarium
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
solarium
Commits
157619d0
Commit
157619d0
authored
Dec 31, 2017
by
Ema Panz
Committed by
Markus Kalkbrenner
Dec 31, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Pagination example (#527)
Add a pagination example, see #521
parent
aa463671
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
examples/1.2-basic-select.php
examples/1.2-basic-select.php
+9
-0
No files found.
examples/1.2-basic-select.php
View file @
157619d0
...
@@ -9,6 +9,15 @@ $client = new Solarium\Client($config);
...
@@ -9,6 +9,15 @@ $client = new Solarium\Client($config);
// get a select query instance
// get a select query instance
$query
=
$client
->
createQuery
(
$client
::
QUERY_SELECT
);
$query
=
$client
->
createQuery
(
$client
::
QUERY_SELECT
);
// Pagination example
$resulsPerPage
=
15
;
$currentPage
=
1
;
// Set the number of results to return
$query
->
setRows
(
$resultsPerPage
);
// Set the 0-based result to start from, taking into account pagination
$query
->
setStart
((
$currentPage
-
1
)
*
$resultsPerPage
);
// this executes the query and returns the result
// this executes the query and returns the result
$resultset
=
$client
->
execute
(
$query
);
$resultset
=
$client
->
execute
(
$query
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment