Created
November 27, 2023 14:55
-
-
Save brianmfear/3b294874a78c233c9a98ff11c6305c4b to your computer and use it in GitHub Desktop.
SSCCE of running a 100k+ SOSL query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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