public SFQueryResult querySimilarFunctions(SFQueryInfo queryInfo,
			SFResultsUpdateListener<SFQueryResult> listener, TaskMonitor monitor)
			throws QueryDatabaseException, CancelledException {
		SFQueryResult result = null;
		try {
			if (database == null || database.getStatus() != Status.Ready) {
				throw new QueryDatabaseException("Connection with database not established");
			}
			if (monitor == null) {
				monitor = TaskMonitor.DUMMY;
			}
			if (listener == null) {
				listener = new NullListener<>();
			}

			//
			// Perform the required initialization:
			// -Initialize signature generator
			// -Hash the functions
			// -Create the query
			// -Create the staging
			//

			QueryNearest query = generateQueryNearest(queryInfo, monitor);
			int localNumStages = numStages;
			if (localNumStages == 0) {
				int funcsPerStage = database.getQueriedFunctionsPerStage();
				localNumStages = queryInfo.getNumberOfStages(funcsPerStage);
			}
			StagingManager stagingManager =
				createStagingManager(queryInfo.getFunctions().size(), localNumStages);

			//
			// Perform the query
			//
			ResponseNearest response =
				(ResponseNearest) doQuery(query, stagingManager, listener, monitor);

			//
			// Create the results for our facade interface
			//
			result =
				new SFQueryResult(queryInfo, database.getURLString(), database.getInfo(), response);
		}
		catch (LSHException e) {
			throw new QueryDatabaseException(e.getMessage());
		}
		finally {
			listener.setFinalResult(result);
		}
		return result;
	}
Query the given server with the parameters provider by {@code queryInfo}.

@param queryInfo a query info object containing the settings for the query
@param listener is the listener to be informed of the query status and incremental results 
		coming back, may be null
@param monitor the task monitor to use; can be null
@return the result object containing the retrieved similar functions; null if the query
        was cancelled
@throws QueryDatabaseException if the query execution fails
@throws CancelledException if the query is cancelled by the user
Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/facade/SimilarFunctionQueryService.java