src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/IndexWorker.js
function fetchIndex() {

		return new Promise(function(resolve, reject) {

			var oIndex = oIndexCache["index"],
				oSerializedIndex;

			if (oIndex) {
				resolve(oIndex);
				return;
			}

			var req = new XMLHttpRequest(),

				onload = function (oEvent) {

					oSerializedIndex = oEvent.target.response || oEvent.target.responseText;

					if (typeof oSerializedIndex !== 'object') {
						// fallback in case the browser does not support automatic JSON parsing
						oSerializedIndex = JSON.parse(oSerializedIndex);
					}

					oSerializedIndex = decompressIndex(oSerializedIndex);

					overrideLunrTokenizer();

					oIndex = lunr.Index.load(oSerializedIndex.lunr);

					oIndexCache["index"] = oIndex;
					oIndexCache["docs"] = oSerializedIndex.docs;

					resolve(oIndex);
				};

			if (!bIsMsieBrowser) { // IE does not support 'json' responseType
				// (and will throw an error if we attempt to set it nevertheless)
				req.responseType = 'json';
			}
			req.addEventListener("load", onload, false);
			req.open("get", URL.SEARCH_INDEX);
			req.send();
		});
	}
function fetchIndex() {

		return new Promise(function(resolve, reject) {

			var oIndex = oIndexCache["index"],
				oSerializedIndex;

			if (oIndex) {
				resolve(oIndex);
				return;
			}

			var req = new XMLHttpRequest(),

				onload = function (oEvent) {

					oSerializedIndex = oEvent.target.response || oEvent.target.responseText;

					if (typeof oSerializedIndex !== 'object') {
						// fallback in case the browser does not support automatic JSON parsing
						oSerializedIndex = JSON.parse(oSerializedIndex);
					}

					oSerializedIndex = decompressIndex(oSerializedIndex);

					overrideLunrTokenizer();

					oIndex = lunr.Index.load(oSerializedIndex.lunr);

					oIndexCache["index"] = oIndex;
					oIndexCache["docs"] = oSerializedIndex.docs;

					resolve(oIndex);
				};

			if (!bIsMsieBrowser) { // IE does not support 'json' responseType
				// (and will throw an error if we attempt to set it nevertheless)
				req.responseType = 'json';
			}
			req.addEventListener("load", onload, false);
			req.open("get", URL.SEARCH_INDEX);
			req.send();
		});
	}
function fetchIndex ( ) { return new Promise ( function ( resolve , reject ) { var oIndex = oIndexCache [ "index" ] , oSerializedIndex ; if ( oIndex ) { resolve ( oIndex ) ; return ; } var req = new XMLHttpRequest ( ) , onload = function ( oEvent ) { oSerializedIndex = oEvent . target . response || oEvent . target . responseText ; if ( typeof oSerializedIndex !== 'object' ) { // fallback in case the browser does not support automatic JSON parsing oSerializedIndex = JSON . parse ( oSerializedIndex ) ; } oSerializedIndex = decompressIndex ( oSerializedIndex ) ; overrideLunrTokenizer ( ) ; oIndex = lunr . Index . load ( oSerializedIndex . lunr ) ; oIndexCache [ "index" ] = oIndex ; oIndexCache [ "docs" ] = oSerializedIndex . docs ; resolve ( oIndex ) ; } ; if ( ! bIsMsieBrowser ) { // IE does not support 'json' responseType // (and will throw an error if we attempt to set it nevertheless) req . responseType = 'json' ; } req . addEventListener ( "load" , onload , false ) ; req . open ( "get" , URL . SEARCH_INDEX ) ; req . send ( ) ; } ) ; }
Obtains the index via network request
or from cache

@returns {Promise<any>}
Obtains the index via network request or from cache