mirror of https://github.com/apache/lucene.git
SOLR-3324: change URL when analysis form is submitted
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1326690 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3b2d951ef5
commit
098de9be54
|
@ -86,11 +86,36 @@ sammy.get
|
|||
this
|
||||
.html( content );
|
||||
|
||||
$( 'option[value="fieldname\=' + response.schema.defaultSearchField + '"]', this )
|
||||
var defaultSearchField = 'fieldname\=' + ( context.params['analysis.fieldname'] || response.schema.defaultSearchField );
|
||||
|
||||
if( context.params['analysis.fieldtype'] )
|
||||
{
|
||||
defaultSearchField = 'fieldtype\=' + context.params['analysis.fieldtype'];
|
||||
}
|
||||
|
||||
$( 'option[value="' + defaultSearchField + '"]', this )
|
||||
.attr( 'selected', 'selected' );
|
||||
|
||||
this
|
||||
.chosen();
|
||||
.chosen()
|
||||
.trigger( 'change' );
|
||||
|
||||
var fields = 0;
|
||||
for( var key in context.params )
|
||||
{
|
||||
if( 'string' === typeof context.params[key] )
|
||||
{
|
||||
fields++;
|
||||
$( '[name="' + key + '"]', analysis_form )
|
||||
.val( context.params[key] );
|
||||
}
|
||||
}
|
||||
|
||||
if( 0 !== fields )
|
||||
{
|
||||
analysis_form
|
||||
.trigger( 'execute' );
|
||||
}
|
||||
},
|
||||
error : function( xhr, text_status, error_thrown)
|
||||
{
|
||||
|
@ -165,21 +190,44 @@ sammy.get
|
|||
|
||||
var button = $( 'button', analysis_form )
|
||||
|
||||
var compute_analysis_params = function()
|
||||
{
|
||||
var params = analysis_form.formToArray();
|
||||
|
||||
var type_or_name = $( '#type_or_name', analysis_form ).val().split( '=' );
|
||||
params.push( { name: 'analysis.' + type_or_name[0], value: type_or_name[1] } );
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
analysis_form
|
||||
.ajaxForm
|
||||
.die( 'submit' )
|
||||
.live
|
||||
(
|
||||
'submit',
|
||||
function( event )
|
||||
{
|
||||
var params = compute_analysis_params();
|
||||
|
||||
context.redirect( context.path.split( '?' ).shift() + '?' + $.param( params ) );
|
||||
return false;
|
||||
}
|
||||
)
|
||||
.die( 'execute' )
|
||||
.live
|
||||
(
|
||||
'execute',
|
||||
function( event )
|
||||
{
|
||||
$.ajax
|
||||
(
|
||||
{
|
||||
url : core_basepath + '/analysis/field?wt=json',
|
||||
url : core_basepath + '/analysis/field?wt=json&analysis.showmatch=true&' + context.path.split( '?' ).pop(),
|
||||
dataType : 'json',
|
||||
beforeSubmit : function( array, form, options )
|
||||
beforeSend : function( xhr, settings )
|
||||
{
|
||||
loader.show( button );
|
||||
button.attr( 'disabled', true );
|
||||
|
||||
array.push( { name: 'analysis.showmatch', value: 'true' } );
|
||||
|
||||
var type_or_name = $( '#type_or_name', form ).val().split( '=' );
|
||||
array.push( { name: 'analysis.' + type_or_name[0], value: type_or_name[1] } );
|
||||
},
|
||||
success : function( response, status_text, xhr, form )
|
||||
{
|
||||
|
@ -239,6 +287,8 @@ sammy.get
|
|||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
var generate_class_name = function( type )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue