src/main/webapp/js/singlepage.js
/**
	 * Completely resets all form and results information and controls, then repopulates the page with the parameters.
	 * Also initiates a search if the parameters contain a valid search. (the 'operation' is valid).
	 *
	 * NOTE: when called with a {} parameter, the entire page will be cleared.
	 *
	 * @param {any} searchParams
	 */
Completely resets all form and results information and controls, then repopulates the page with the parameters.
Also initiates a search if the parameters contain a valid search. (the 'operation' is valid).

when called with a {} parameter, the entire page will be cleared.

@param {any} searchParams
Completely resets all form and results information and controls then repopulates the page with the parameters . Also initiates a search if the parameters contain a valid search . ( the ' operation ' is valid ) . when called with a {} parameter the entire page will be cleared . @param { any } searchParams
function toPageState(searchParams) {
		SINGLEPAGE.FORM.reset();
		$('#querybuilder').data('builder').reset();
		$('#querybox').val(undefined);
		if (searchParams.pattern) {
			if (searchParams.pattern.constructor === Array) {
				$.each(searchParams.pattern, function (index, element) {
					SINGLEPAGE.FORM.setPropertyValues(element);
				});
			} else {
				$('#querybox').val(searchParams.pattern);
				$('#searchTabs a[href="#query"]').tab('show');
				if (populateQueryBuilder(searchParams.pattern))
					$('#searchTabs a[href="#advanced"]').tab('show');
			}
		}
		$.each(searchParams.filters, function (index, element) {
			SINGLEPAGE.FORM.setFilterValues(element.name, element.values);
		});
		SINGLEPAGE.FORM.setWithin(searchParams.within);
		$('#resultsPerPage').selectpicker('val', [searchParams.pageSize || 50]);
		$('#sampleSize').val(searchParams.sampleSize || '');
		$('#sampleMode').selectpicker('val', [searchParams.sampleMode || 'percentage']);
		$('#sampleSeed').val(searchParams.sampleSeed || '');
		SINGLEPAGE.INTERFACE.reset();
		SINGLEPAGE.INTERFACE.setParameters(searchParams);
		if (searchParams.operation === 'hits') {
			$('#resultTabs a[href="#tabHits"]').tab('show');
		} else if (searchParams.operation === 'docs') {
			$('#resultTabs a[href="#tabDocs"]').tab('show');
		}
	}
function toPageState ( searchParams ) { SINGLEPAGE . FORM . reset ( ) ; $ ( '#querybuilder' ) . data ( 'builder' ) . reset ( ) ; $ ( '#querybox' ) . val ( undefined ) ; if ( searchParams . pattern ) { if ( searchParams . pattern . constructor === Array ) { $ . each ( searchParams . pattern , function ( index , element ) { SINGLEPAGE . FORM . setPropertyValues ( element ) ; } ) ; } else { $ ( '#querybox' ) . val ( searchParams . pattern ) ; $ ( '#searchTabs a[href="#query"]' ) . tab ( 'show' ) ; if ( populateQueryBuilder ( searchParams . pattern ) ) $ ( '#searchTabs a[href="#advanced"]' ) . tab ( 'show' ) ; } } $ . each ( searchParams . filters , function ( index , element ) { SINGLEPAGE . FORM . setFilterValues ( element . name , element . values ) ; } ) ; SINGLEPAGE . FORM . setWithin ( searchParams . within ) ; $ ( '#resultsPerPage' ) . selectpicker ( 'val' , [ searchParams . pageSize || 50 ] ) ; $ ( '#sampleSize' ) . val ( searchParams . sampleSize || '' ) ; $ ( '#sampleMode' ) . selectpicker ( 'val' , [ searchParams . sampleMode || 'percentage' ] ) ; $ ( '#sampleSeed' ) . val ( searchParams . sampleSeed || '' ) ; SINGLEPAGE . INTERFACE . reset ( ) ; SINGLEPAGE . INTERFACE . setParameters ( searchParams ) ; if ( searchParams . operation === 'hits' ) { $ ( '#resultTabs a[href="#tabHits"]' ) . tab ( 'show' ) ; } else if ( searchParams . operation === 'docs' ) { $ ( '#resultTabs a[href="#tabDocs"]' ) . tab ( 'show' ) ; } }
Completely resets all form and results information and controls, then repopulates the page with the parameters.
Completely resets all form and results information and controls then repopulates the page with the parameters .
// reset and repopulate the main form // In the case of an array as search pattern,  it contains the basic/simple search parameters // We have a raw cql query string, attempt to parse it using the querybuilder, // otherwise fall back to the raw cql view // Restore the results per page, sample info, etc // Clear the results area, then actually run the search // Select a tab to display if there is enough information to perform a search // The tab will then auto-refresh and display results.