Skip to content

Instantly share code, notes, and snippets.

@brianmfear
Created November 27, 2023 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianmfear/3b294874a78c233c9a98ff11c6305c4b to your computer and use it in GitHub Desktop.
Save brianmfear/3b294874a78c233c9a98ff11c6305c4b to your computer and use it in GitHub Desktop.
SSCCE of running a 100k+ SOSL query
String[] objects = new String[0];
Set<String> exceptions = new Set<String> { 'caseexternaldocument' };
for(sObjectType t: Schema.getGlobalDescribe().values()) {
DescribeSObjectResult r = t.getDescribe();
if(r.isSearchable() && !exceptions.contains((''+t).toLowerCase())) {
objects.add(t+'('+string.join(r.fields.getMap().keySet(),',')+')');
}
}
String searchTerm = 'find {demo} in all fields returning '+string.join(objects,',');
System.debug(searchTerm.length());
Search.find(searchTerm);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment