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) {

					if (oEvent.target.response === null) {
						return self.postMessage({error: "Resource file searchindex.json not found"});
					}

					oSerializedIndex = oEvent.target.response;

					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);
				};

			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

@returns {Promise}
Obtains the index via network request or from cache @returns { Promise }
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) {
					if (oEvent.target.response === null) {
						return self.postMessage({error: "Resource file searchindex.json not found"});
					}
					oSerializedIndex = oEvent.target.response;
					if (typeof oSerializedIndex !== 'object') {
						oSerializedIndex = JSON.parse(oSerializedIndex);
					}
					oSerializedIndex = decompressIndex(oSerializedIndex);
					overrideLunrTokenizer();
					oIndex = lunr.Index.load(oSerializedIndex.lunr);
					oIndexCache["index"] = oIndex;
					oIndexCache["docs"] = oSerializedIndex.docs;
					resolve(oIndex);
				};
			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 ) { if ( oEvent . target . response === null ) { return self . postMessage ( { error : "Resource file searchindex.json not found" } ) ; } oSerializedIndex = oEvent . target . response ; if ( typeof oSerializedIndex !== 'object' ) { oSerializedIndex = JSON . parse ( oSerializedIndex ) ; } oSerializedIndex = decompressIndex ( oSerializedIndex ) ; overrideLunrTokenizer ( ) ; oIndex = lunr . Index . load ( oSerializedIndex . lunr ) ; oIndexCache [ "index" ] = oIndex ; oIndexCache [ "docs" ] = oSerializedIndex . docs ; resolve ( oIndex ) ; } ; 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
Obtains the index via network request or from cache
// fallback in case the browser does not support automatic JSON parsing