Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed potentially slow score/trend on segmented result sets. Fixed sc…

…ore/trend from pages > 1
  • Loading branch information...
commit 975351828091530dc414333875aeadb7bb64360c 1 parent 4a0f260
Rashid Khan authored
Showing with 12 additions and 7 deletions.
  1. +4 −1 js/ajax.js
  2. +8 −6 loader2.php
View
5 js/ajax.js
@@ -126,7 +126,7 @@ function getPage() {
//console.log(
// 'curl -XGET \'http://elasticsearch:9200/'+resultjson.indices+
// '/_search?pretty=true\' -d\''+resultjson.elasticsearch_json+'\'');
- //console.log(resultjson.debug);
+ // console.log(resultjson.debug);
$('#graphheader,#graph').text("");
@@ -171,14 +171,17 @@ function getPage() {
}
$("#sidebar").delegate("li.analyze_btn a", "click", function () {
+ window.hashjson.offset = 0;
analyzeField(
$(this).parents().eq(2).children('a').text(), "analyze")});
$("#sidebar").delegate("li.trend_btn a", "click",function () {
+ window.hashjson.offset = 0;
analyzeField(
$(this).parents().eq(2).children('a').text(), "trend")});
$("#sidebar").delegate("li.stat_btn a", "click",function () {
+ window.hashjson.offset = 0;
analyzeField(
$(this).parents().eq(2).children('a').text(), "mean")});
View
14 loader2.php
@@ -262,7 +262,8 @@ protected function processQuery ($req, $query) {
while($return->hits <= ($req->offset + $query->size)
&& $i < sizeof($index_array))
{
- $return->debug[$i] = $this->index;
+ $query->size = $query->size - sizeof($result->hits->hits);
+ $return->debug[$i] = $query->size;
if(($query->size - $req->offset) < 0) {
$query->from = 0;
}
@@ -276,11 +277,6 @@ protected function processQuery ($req, $query) {
$result->hits->hits,$result_tmp->hits->hits);
$i++;
}
- if($req->mode == '') {
- $slice = $this->config['results_per_page'];
- $result->hits->hits = array_slice($result->hits->hits, 0, $slice);
- }
-
} else {
$result = $this->esQuery($query);
$return->hits = $result->hits->total;
@@ -298,10 +294,14 @@ protected function processQuery ($req, $query) {
switch ($req->mode) {
case 'analyze':
+ $slice = $this->config['analyze_limit'];
+ $result->hits->hits = array_slice($result->hits->hits, 0, $slice);
$return = $this->analyzeField($req, $query, $return, $result);
break;
case 'trend':
+ $slice = $this->config['analyze_limit'];
+ $result->hits->hits = array_slice($result->hits->hits, 0, $slice);
$return = $this->trendField($req, $query, $return, $result);
break;
@@ -310,6 +310,8 @@ protected function processQuery ($req, $query) {
break;
default:
+ $slice = $this->config['results_per_page'];
+ $result->hits->hits = array_slice($result->hits->hits, 0, $slice);
$base_fields = array_values(array_unique(array_merge(
array('@message'),
$this->config['default_fields'])));
Please sign in to comment.
Something went wrong with that request. Please try again.