protected int queryFunctions(QueryNearest query, BSimSqlClause filter, ResponseNearest response,
			DescriptionManager descMgr, Iterator<FunctionDescription> iter)
			throws SQLException, LSHException {

		// Keep a map of the feature vectors and their query results; if we have vectors that
		// are of equal value, we'll just query the first one, and use those results for the
		// others.
		HashMap<LSHVector, List<VectorResult>> vecToResultMap = new HashMap<>();

		while (iter.hasNext()) {
			FunctionDescription frec = iter.next();
			SignatureRecord srec = frec.getSignatureRecord();

			if (srec == null) {
				continue;
			}
			LSHVector thevec = srec.getLSHVector();
			double len2 = vectorFactory.getSelfSignificance(thevec);

			// Self significance should be bigger than the significance threshold
			// (or its impossible our result can exceed the threshold)
			if (len2 < query.signifthresh) {
				continue;
			}
			response.totalfunc += 1;
			SimilarityResult simres = new SimilarityResult(frec);
			if (descMgr.getExecutableRecordSet().size() > 1000) {
				descMgr.clear();
			}
			else {
				// Try to preserve ExecutableRecords so we don't have to do SQL 
				// every time
				descMgr.clearFunctions();
			}
			queryNearest(simres, descMgr, thevec, query, filter, vecToResultMap);
			if (simres.size() == 0) {
				continue;
			}
			response.totalmatch += 1;
			if (simres.size() == 1) {
				response.uniquematch += 1;
			}

			response.result.add(simres);

			simres.transfer(response.manage, true);
		}

		return vecToResultMap.size();
	}
@param query the query to execute
@param filter the function filter 
@param response the response object
@param descMgr the executable descriptor 
@param iter the function iterator 
@return the number of unique results found
@throws SQLException if there is an error issuing the query
@throws LSHException if there is a problem creating executable records
Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/AbstractSQLFunctionDatabase.java