Unexpected runtime error

The runtime has encountered an unexpected error.

Error source

Page Name:/DepartmentContentPage.xsp
Control Id: taxReturn

Exception

Error while executing JavaScript computed expression
Script interpreter error, line=7, col=35: [TypeError] Exception occurred calling method NotesDatabase.FTSearch(string) null
   at [/SearchCode.jss].searchTax()

JavaScript code

   1: function searchTax() {
   2: 	var i = 1;
   3: 	var searchstr = ""
   4: 		searchstr = "FIELD searchName CONTAINS (" + sessionScope.searchName + ") & (FIELD TaxYear = " + @TextToNumber(sessionScope.searchTYear) +")";
   5: 	print (searchstr)
   6: 		var itemCount=0;
   7: 		var dc = database.FTSearch(searchstr);
   8: 		var tdates = ""
   9: 		var dist = new Array();
  10: 		var repid = new Array();
  11: 
  12: 		var foundDoc : NotesDocument;
  13: 		foundDoc = dc.getFirstDocument();
  14: 
  15: 			while( foundDoc != null){ 
  16: 				if (inArray(repid, foundDoc.getItemValueString("DOCID")) == false) {
  17: 					itemCount++
  18: 					dist[itemCount] = @UpperCase(foundDoc.getItemValueString("Name")) 
  19: 					//print (@UpperCase(foundDoc.getItemValueString("Facility")))
  20: 					//print(foundDoc.getItemValueString("COMPANYDOCID"))
  21: 					repid[itemCount] = foundDoc.getItemValueString("DOCID");
  22: 				}
  23: 			
  24: 				foundDoc = dc.getNextDocument(foundDoc) 
  25: 			
  26: 			}
  27:  
  28:  print (itemCount)
  29:  
  30: 			if (itemCount > 1){
  31: 				  		//Quicksort
  32: 			   		//print("Quicksort " + @Text(itemCount) + " records.");
  33: 			 		quickSort(dist,repid,1,itemCount)
  34: 			}
  35: 
  36: 		var newSortedDocs = database.createDocumentCollection();
  37: 	
  38: 			for (var x = 1; x <= itemCount; x++){
  39: 				   	if (repid[x] != null && repid[x] != "" ){
  40: 				   		//print ("ID: " + repid[x] + "*");
  41: 				   		if (database.getDocumentByUNID(repid[x]) != null) {
  42: 					   		newSortedDocs.addDocument(database.getDocumentByUNID(repid[x]))
  43: 				   		}
  44: 				   }
  45: 			   }
  46: 
  47: 		return newSortedDocs
  48: 	
  49: }
  50: 
  51: 
  52: function quickSort(array, array2, start, end)
  53: {
  54: 	var i : integer;
  55: 	var k : integer;
  56: 	var pivot;
  57: 	var temp;
  58: 	
  59:         i = start;                          // index of left-to-right scan
  60:         k = end;                            // index of right-to-left scan
  61: 
  62:         if (end - start >= 1)                   // check that there are at least two elements to sort
  63:         {
  64:                 pivot = array[start];       // set the pivot as the first element in the partition
  65: 
  66:                 while (k > i)                   // while the scan indices from left and right have not met,
  67:                 {
  68:                         while (array[i] <= pivot && i <= end && k > i)  // from the left, look for the first
  69:                                 i++;                                    // element greater than the pivot
  70:                         while (array[k] > pivot && k >= start && k >= i) // from the right, look for the first
  71:                             k--;                                        // element not greater than the pivot
  72:                         if (k > i) {
  73: 								temp = array[i];           // store the first value in a temp
  74: 								array[i] = array[k];      // copy the value of the second into the first
  75: 								array[k] = temp;               // copy the value of the temp into the second
  76: 								temp = array2[i];           // store the first value in a temp
  77: 								array2[i] = array2[k];      // copy the value of the second into the first
  78: 								array2[k] = temp;               // copy the value of the temp into the second
  79:                 				}
  80:                 }
  81: 				temp = array[start];           // store the first value in a temp
  82: 				array[start] = array[k];      // copy the value of the second into the first
  83: 				array[k] = temp;               // copy the value of the temp into the second
  84: 				temp = array2[start];           // store the first value in a temp
  85: 				array2[start] = array2[k];      // copy the value of the second into the first
  86: 				array2[k] = temp;               // copy the value of the temp into the second
  87: 
  88:                 quickSort(array, array2, start, k - 1); // quicksort the left partition
  89:                 quickSort(array, array2, k + 1, end);   // quicksort the right partition
  90:         }
  91:         else    // if there is only one element in the partition, do not do any sorting
  92:         {
  93:                 return;                     // the array is sorted, so exit
  94:         }
  95: }
  96: 
  97: function inArray(array, value)
  98: {
  99: 	for(i=0; i < array.length; i++){ 
 100:     if(array[i] === value) 
 101:       return true; 
 102:   	}; 
 103:   	return false; 
 104: }
 105: 
 106: function swap(array, index1, index2) 
 107: // pre: array is full and index1, index2 < array.length
 108: // post: the values at indices 1 and 2 have been swapped
 109: {
 110: 	var temp
 111: 	temp = array[index1];           // store the first value in a temp
 112: 	array[index1] = array[index2];      // copy the value of the second into the first
 113: 	array[index2] = temp;               // copy the value of the temp into the second
 114: }

Stack Trace