mirror of https://github.com/apache/lucene.git
SOLR-4225: Term info page under schema browser shows incorrect count of terms
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1438900 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8cf0735393
commit
8b7fb2fe82
|
@ -87,6 +87,9 @@ Bug Fixes
|
|||
next record the same as a problem parsing the record - log the exception and
|
||||
break. (Mark Miller)
|
||||
|
||||
* SOLR-4225: Term info page under schema browser shows incorrect count of terms
|
||||
(steffkes)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -390,7 +390,8 @@
|
|||
color: #333;
|
||||
}
|
||||
|
||||
#content #schema-browser #data #field .topterms-holder
|
||||
#content #schema-browser #data #field .topterms-holder,
|
||||
#content #schema-browser #data #field .histogram-holder
|
||||
{
|
||||
border-left: 1px solid #f0f0f0;
|
||||
display: none;
|
||||
|
@ -448,12 +449,12 @@
|
|||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
/* possible overwrite with inline style */
|
||||
#content #schema-browser .topterms-holder li p
|
||||
{
|
||||
background-color: #999;
|
||||
color: #fff;
|
||||
float: left;
|
||||
width: 25px;
|
||||
}
|
||||
|
||||
#content #schema-browser .topterms-holder li p span
|
||||
|
@ -463,6 +464,7 @@
|
|||
text-align: right;
|
||||
}
|
||||
|
||||
/* possible overwrite with inline style */
|
||||
#content #schema-browser .topterms-holder li ul
|
||||
{
|
||||
margin-left: 30px;
|
||||
|
@ -492,51 +494,65 @@
|
|||
background-color: #c0c0c0;
|
||||
}
|
||||
|
||||
#content #schema-browser #data #field .histogram-holder
|
||||
#content #schema-browser #data #field .histogram-holder ul
|
||||
{
|
||||
border-left: 1px solid #f0f0f0;
|
||||
display: none;
|
||||
float: left;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
#content #schema-browser #data #field .histogram-holder .histogram
|
||||
#content #schema-browser #data #field .histogram-holder li
|
||||
{
|
||||
height: 150px;
|
||||
margin-bottom: 2px;
|
||||
position: relative;
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
#content #schema-browser #data #field .histogram-holder .histogram.single canvas
|
||||
{
|
||||
background-color: #c0c0c0;
|
||||
}
|
||||
|
||||
#content #schema-browser #data #field .histogram-holder dt,
|
||||
#content #schema-browser #data #field .histogram-holder dd
|
||||
{
|
||||
float: left;
|
||||
font-size: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#content #schema-browser #data #field .histogram-holder span
|
||||
#content #schema-browser #data #field .histogram-holder li.odd
|
||||
{
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
||||
#content #schema-browser #data #field .histogram-holder li dl,
|
||||
#content #schema-browser #data #field .histogram-holder li dt
|
||||
{
|
||||
padding-top: 1px;
|
||||
padding-bottom: 1px;
|
||||
}
|
||||
|
||||
#content #schema-browser #data #field .histogram-holder li dl
|
||||
{
|
||||
background-color: #c0c0c0;
|
||||
min-width: 1px;
|
||||
}
|
||||
|
||||
#content #schema-browser #data #field .histogram-holder li dt
|
||||
{
|
||||
color: #a0a0a0;
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
left: -25px;
|
||||
top: 0px;
|
||||
}
|
||||
|
||||
#content #schema-browser #data #field .histogram-holder li dt span
|
||||
{
|
||||
display: block;
|
||||
width: 20px;
|
||||
padding-right: 4px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#content #schema-browser #data #field .histogram-holder dt
|
||||
#content #schema-browser #data #field .histogram-holder li dd
|
||||
{
|
||||
padding-right: 1px;
|
||||
clear: left;
|
||||
float: left;
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
#content #schema-browser #data #field .histogram-holder dd
|
||||
#content #schema-browser #data #field .histogram-holder li:hover dl
|
||||
{
|
||||
padding-right: 3px;
|
||||
background-color: #b0b0b0;
|
||||
}
|
||||
|
||||
#content #schema-browser #data #field .histogram-holder dd span
|
||||
#content #schema-browser #data #field .histogram-holder li:hover dt
|
||||
{
|
||||
width: 25px;
|
||||
}
|
||||
color: #333;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -25,7 +25,6 @@ require
|
|||
'lib/order!lib/jquery.form',
|
||||
'lib/order!lib/jquery.jstree',
|
||||
'lib/order!lib/jquery.sammy',
|
||||
'lib/order!lib/jquery.sparkline',
|
||||
'lib/order!lib/jquery.timeago',
|
||||
'lib/order!lib/jquery.blockUI',
|
||||
'lib/order!lib/highlight',
|
||||
|
|
|
@ -468,6 +468,11 @@ var solr_admin = function( app_config )
|
|||
return json_str;
|
||||
};
|
||||
|
||||
this.format_number = function format_number( number )
|
||||
{
|
||||
return ( number || 0 ).toString().replace( /\B(?=(\d{3})+(?!\d))/g, ' ' );
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
var app = new solr_admin( app_config );
|
||||
|
|
|
@ -440,11 +440,6 @@ sammy.get
|
|||
var messages_count = 0;
|
||||
for( var key in messages ) { messages_count++; }
|
||||
|
||||
var format_number = function format_number( number )
|
||||
{
|
||||
return ( number || 0 ).toString().replace( /\B(?=(\d{3})+(?!\d))/g, '\'' );
|
||||
};
|
||||
|
||||
function dataimport_compute_details( response, details_element, elapsed_seconds )
|
||||
{
|
||||
details_element
|
||||
|
@ -464,10 +459,10 @@ sammy.get
|
|||
{
|
||||
var value = parseInt( response.statusMessages[document_config[key]], 10 );
|
||||
|
||||
var detail = '<abbr title="' + document_config[key].esc() + '">' + key.esc() + '</abbr>: ' + format_number( value ).esc();
|
||||
var detail = '<abbr title="' + document_config[key].esc() + '">' + key.esc() + '</abbr>: ' + app.format_number( value ).esc();
|
||||
if( elapsed_seconds && 'skipped' !== key.toLowerCase() )
|
||||
{
|
||||
detail += ' <span>(' + format_number( Math.round( value / elapsed_seconds ) ).esc() + '/s)</span>'
|
||||
detail += ' <span>(' + app.format_number( Math.round( value / elapsed_seconds ) ).esc() + '/s)</span>'
|
||||
}
|
||||
|
||||
document_details.push( detail );
|
||||
|
@ -523,7 +518,7 @@ sammy.get
|
|||
/\d{4,}/g,
|
||||
function( match, position, string )
|
||||
{
|
||||
return format_number( parseInt( match, 10 ) );
|
||||
return app.format_number( parseInt( match, 10 ) );
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -66,9 +66,7 @@ var load_terminfo = function( trigger_element, core_basepath, field, data_elemen
|
|||
},
|
||||
success : function( response, text_status, xhr )
|
||||
{
|
||||
$( 'span', trigger_element )
|
||||
.removeClass( 'loader' );
|
||||
|
||||
var additional_styles = [];
|
||||
var field_data = response.fields[field];
|
||||
|
||||
if( !field_data || !( field_data.topTerms && field_data.histogram ) )
|
||||
|
@ -79,6 +77,11 @@ var load_terminfo = function( trigger_element, core_basepath, field, data_elemen
|
|||
return false;
|
||||
}
|
||||
|
||||
var get_width = function get_width()
|
||||
{
|
||||
return $( this ).width();
|
||||
}
|
||||
|
||||
var topterms_holder_element = $( '.topterms-holder', data_element );
|
||||
var histogram_holder_element = $( '.histogram-holder', data_element );
|
||||
|
||||
|
@ -111,7 +114,7 @@ var load_terminfo = function( trigger_element, core_basepath, field, data_elemen
|
|||
|
||||
topterms_frq_last = topterms[i+1];
|
||||
topterms_content += '<li class="clearfix">'
|
||||
+ '<p><span>' + topterms_frq_last.esc() + '</span></p>' + "\n"
|
||||
+ '<p><span>' + app.format_number( topterms_frq_last ) + '</span></p>' + "\n"
|
||||
+ '<ul>' + "\n";
|
||||
}
|
||||
|
||||
|
@ -129,6 +132,13 @@ var load_terminfo = function( trigger_element, core_basepath, field, data_elemen
|
|||
topterms_table_element
|
||||
.html( topterms_content );
|
||||
|
||||
var max_width = 10 + Math.max.apply( Math, $( 'p', topterms_table_element ).map( get_width ).get() );
|
||||
additional_styles.push
|
||||
(
|
||||
topterms_table_element.selector + ' p { width: ' + max_width + 'px !important; }' + "\n" +
|
||||
topterms_table_element.selector + ' ul { margin-left: ' + ( max_width + 5 ) + 'px !important; }'
|
||||
);
|
||||
|
||||
topterms_count_element
|
||||
.val( topterms_count );
|
||||
|
||||
|
@ -152,52 +162,57 @@ var load_terminfo = function( trigger_element, core_basepath, field, data_elemen
|
|||
histogram_holder_element
|
||||
.show();
|
||||
|
||||
var histogram_element = $( '.histogram', histogram_holder_element );
|
||||
|
||||
var histogram_values = luke_array_to_hash( field_data.histogram );
|
||||
var histogram_legend = '';
|
||||
|
||||
histogram_holder_element
|
||||
.show();
|
||||
var histogram_entries = [];
|
||||
|
||||
var histogram_max = null;
|
||||
for( var key in histogram_values )
|
||||
{
|
||||
histogram_max = Math.max( histogram_max, histogram_values[key] );
|
||||
}
|
||||
|
||||
for( var key in histogram_values )
|
||||
{
|
||||
histogram_legend += '<dt><span>' + key + '</span></dt>' + "\n" +
|
||||
'<dd title="' + key + '">' +
|
||||
'<span>' + histogram_values[key] + '</span>' +
|
||||
'</dd>' + "\n";
|
||||
histogram_entries.push
|
||||
(
|
||||
'<li>' + "\n" +
|
||||
' <dl class="clearfix" style="width: ' + ( ( histogram_values[key] / histogram_max ) * 100 ) + '%;">' + "\n" +
|
||||
' <dt><span>' + app.format_number( key ) + '</span></dt>' + "\n" +
|
||||
' <dd><span>' + app.format_number( histogram_values[key] ) + '</span></dd>' + "\n" +
|
||||
' </dl>' + "\n" +
|
||||
'</li>'
|
||||
);
|
||||
}
|
||||
|
||||
$( 'dl', histogram_holder_element )
|
||||
.html( histogram_legend );
|
||||
$( 'ul', histogram_holder_element )
|
||||
.html( histogram_entries.join( "\n" ) );
|
||||
|
||||
var histogram_values = luke_array_to_struct( field_data.histogram ).values;
|
||||
$( 'ul li:even', histogram_holder_element )
|
||||
.addClass( 'odd' );
|
||||
|
||||
histogram_element
|
||||
.sparkline
|
||||
(
|
||||
histogram_values,
|
||||
{
|
||||
type : 'bar',
|
||||
barColor : '#c0c0c0',
|
||||
zeroColor : '#000000',
|
||||
height : histogram_element.height(),
|
||||
barWidth : 46,
|
||||
barSpacing : 3
|
||||
}
|
||||
);
|
||||
|
||||
1 === histogram_values.length
|
||||
? histogram_element.addClass( 'single' )
|
||||
: histogram_element.removeClass( 'single' );
|
||||
var max_width = 10 + Math.max.apply( Math, $( 'dt', histogram_holder_element ).map( get_width ).get() );
|
||||
additional_styles.push
|
||||
(
|
||||
histogram_holder_element.selector + ' ul { margin-left: ' + max_width + 'px !important; }' + "\n" +
|
||||
histogram_holder_element.selector + ' li dt { left: ' + ( max_width * -1 ) + 'px !important; width: ' + max_width + 'px !important; }'
|
||||
);
|
||||
}
|
||||
|
||||
if( additional_styles )
|
||||
{
|
||||
terminfo_element
|
||||
.prepend( '<style type="text/css">' + additional_styles.join( "\n" ) + '</style>' );
|
||||
}
|
||||
},
|
||||
error : function( xhr, text_status, error_thrown)
|
||||
{
|
||||
terminfo_element
|
||||
.addClass( 'disabled' );
|
||||
},
|
||||
complete : function( xhr, text_status )
|
||||
{
|
||||
$( 'span', trigger_element )
|
||||
.removeClass( 'loader' );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -158,12 +158,8 @@ limitations under the License.
|
|||
|
||||
<p class="head">Histogram:</p>
|
||||
|
||||
<div class="histogram"></div>
|
||||
<ul></ul>
|
||||
|
||||
<dl class="clearfix">
|
||||
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue