function checkForHits()

in content/flexunit/asdoc/flexUnit4FluintExtensions/help.js [366:424]


function checkForHits()
{
	var inputWords = new Array();
	var tempArr = new Array();

	// Split the search term into individual search words
		tempArr = searchTerm.split(" ");
		for(var ndx=0; ndx < tempArr.length; ndx++) {
			if( tempArr[ndx].length ) {
				inputWords[inputWords.length] = tempArr[ndx];
			}
		}

	// Initialization
		matchesArrHits = new Array();
		matchesArrIndices = new Array();

	// Initialize the 'maskArr' and the 'hitsArr'
		maskArr = new Array();
		hitsArr = new Array();
		for( var ndx = 0; ndx < fileArr.length; ndx++ ) {
			maskArr[maskArr.length] = 1;
			hitsArr[hitsArr.length] = 0;
		}

	// Do checking for matches on EACH OF THE INPUT WORDS
		for( var ndx = 0; ndx < inputWords.length; ndx++ ) {

			// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
			if( ! checkForHitsWordAgainstPages( inputWords[ndx] ) ) {
				return; 	// No sense in continuing, match has failed.
			}
			// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

			for( var ndx2 = 0; ndx2 < hitsArr.length; ndx2++ ) {
				if( hitsArr[ndx2] == 0 ) {
					maskArr[ndx2] = 0;
				}
				else {
					if( maskArr[ndx2] != 0 ) {
						maskArr[ndx2] += hitsArr[ndx2];
					}
				}
			}
		}

	// From the final 'maskArr', generate 'matchesArrHits' and 'matchesArrIndices'	
		for( var ndx = 0; ndx < maskArr.length; ndx++ ) {
			if( maskArr[ndx] ) {
				matchesArrHits[matchesArrHits.length] = maskArr[ndx];
				matchesArrIndices[matchesArrIndices.length] = ndx;
			}
		}

	// If there were any hits, then sort them by highest hits first
		if( matchesArrIndices.length ) {
			bubbleSortWithShadow(matchesArrHits, matchesArrIndices);
		}
}