Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
[index.lucene] Send a <pagination> tag in results if limit is set and…
Browse files Browse the repository at this point in the history
… number of hits is cut.
  • Loading branch information
cdujeu committed Dec 4, 2015
1 parent 604fc1c commit 30afd12
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/src/plugins/index.lucene/class.AjxpLuceneIndexer.php
Expand Up @@ -188,6 +188,9 @@ public function applyAction($actionName, $httpVars, $fileVars)
if(isSet($httpVars['limit'])){
$limit = intval($httpVars['limit']);
}
if(!isSet($returnNodes) && !empty($limit) && count($hits) > $limit){
AJXP_XMLWriter::renderPaginationData(count($hits), 1, 1);
}
foreach ($hits as $hit) {
// Backward compatibility
$hit->node_url = preg_replace("#ajxp\.[a-z_]+://#", "pydio://", $hit->node_url);
Expand Down Expand Up @@ -227,7 +230,7 @@ public function applyAction($actionName, $httpVars, $fileVars)
AJXP_XMLWriter::renderAjxpNode($tmpNode);
}
$cursor++;
if(isSet($limit) && $cursor > $limit) break;
if(isSet($limit) && $cursor >= $limit) break;
}
if(!isSet($returnNodes)) AJXP_XMLWriter::close();
if ($commitIndex) {
Expand Down

0 comments on commit 30afd12

Please sign in to comment.