Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions controllers/components/ApiComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ public function search($args)
$index = $solrComponent->getSolrIndex();
UtilityComponent::beginIgnoreWarnings(); //underlying library can generate warnings, we need to eat them
$factor = 10;
$searchOptions = array(
'sort' => ' text-journal.revision_id desc',
'fl' => '*,score'); //extend limit to allow some room for policy filtering
if("text-journal.enable:true AND ( text-journal.community:".$defaultCommunity." )" == $args['query'])
{
$factor = 100000; // Get all the ids when creating the cache
Expand All @@ -69,7 +72,7 @@ public function search($args)
}
else
{
$response = $index->search($args['query'], 0, $limit * $factor + $offset, array('fl' => '*,score')); //extend limit to allow some room for policy filtering
$response = $index->search($args['query'], 0, $limit * $factor + $offset, $searchOptions);
UtilityComponent::endIgnoreWarnings();
foreach($response->response->docs as $doc)
{
Expand All @@ -79,7 +82,7 @@ public function search($args)
{
// Increase the factor to capture all available submissions for searching the target level
$factor = 100000;
$response = $index->search($args['secondQuery'], 0, $limit * $factor + $offset, array('fl' => '*,score')); //extend limit to allow some room for policy filtering
$response = $index->search($args['secondQuery'], 0, $limit * $factor + $offset, $searchOptions);
}
foreach($response->response->docs as $doc)
{
Expand Down