be00edb2a6ef8c715b715cf0261572feead28c21
hiram
  Sat Feb 3 13:11:41 2024 -0800
beginning to run FULLTEXT search on asmSummary table refs #23589

diff --git src/hg/lib/asmSummary.c src/hg/lib/asmSummary.c
index f4319f4..01a54fd 100644
--- src/hg/lib/asmSummary.c
+++ src/hg/lib/asmSummary.c
@@ -830,15 +830,29 @@
 fprintf(f, "%s", el->nonCodingGeneCount);
 fputc('"',f);
 fputc(',',f);
 fputc('"',f);
 fprintf(f,"pubmedId");
 fputc('"',f);
 fputc(':',f);
 fputc('"',f);
 fprintf(f, "%s", el->pubmedId);
 fputc('"',f);
 fputc('}',f);
 }
 
 /* -------------------------------- End autoSql Generated Code -------------------------------- */
 
+struct asmSummary *asmSummaryFullText(struct sqlConnection *conn, char *words, long long rowLimit, long long *totalMatch)
+/* perform a FULLTEXT search on the asmSummary table with the list
+ *   of words string (may be only a single word)
+ * return is a list of items found up to rowLimit, or NULL if none found
+ *   also returning totalMatch to understand if it is more than the rowLimit
+ */
+{
+char query[4096];
+sqlSafef(query, sizeof(query), "SELECT count(*) FROM asmSummary WHERE MATCH (bioproject, biosample, organismName, isolate, asmName, asmSubmitter, annotationProvider, annotationName) AGAINST (\"%s\")", words);
+*totalMatch = (long long) sqlQuickNum(conn, query);
+sqlSafef(query, sizeof(query), "SELECT * FROM asmSummary WHERE MATCH (bioproject, biosample, organismName, isolate, asmName, asmSubmitter, annotationProvider, annotationName) AGAINST (\"%s\") LIMIT %lld", words, rowLimit);
+struct asmSummary *list = asmSummaryLoadByQuery(conn, query);
+return list;
+}