Mark Robinson
06/11/2021, 6:16 PMvar someSearch = search.create({ [assume valid search here] });
var countOfResults = someSearch.runPaged().count;
if(countOfResults == 1){
var one_result = someSearch.run().getRange(0,1);
}
Am I technically eating up more governance by running the search twice or does the runPaged meta data not incur governance?stalbert
06/11/2021, 6:25 PMrunPaged()
is 5 governance units according to help. If you just need to get the first result I write it like this
const firstResult = Seq(LazySearch(someSearch)).map(nsSearchResult2obj()).first()
stalbert
06/11/2021, 6:27 PMsomeSearch.run().getRange(0,1)
and skip the first 'countOfResults'. If NS returns nothing from getRange()
then you know there's no first result?Mark Robinson
06/11/2021, 6:27 PMMark Robinson
06/11/2021, 6:28 PMstalbert
06/11/2021, 6:29 PMMark Robinson
06/11/2021, 6:29 PMMark Robinson
06/11/2021, 6:29 PMstalbert
06/11/2021, 6:30 PMMark Robinson
06/11/2021, 6:32 PMbattk
06/11/2021, 9:47 PMbattk
06/11/2021, 9:48 PMbattk
06/11/2021, 9:48 PMbattk
06/11/2021, 9:49 PMMark Robinson
06/11/2021, 9:50 PMbattk
06/11/2021, 9:51 PMMark Robinson
06/11/2021, 9:51 PMMark Robinson
06/11/2021, 9:51 PMMark Robinson
06/11/2021, 9:53 PMbattk
06/11/2021, 9:53 PMMark Robinson
06/11/2021, 9:54 PMMark Robinson
06/11/2021, 9:55 PMbattk
06/11/2021, 10:00 PMMark Robinson
06/11/2021, 10:02 PMbattk
06/11/2021, 10:08 PM