I'm implementing a custom view on deleted items (I'm making a 'Recycle Bin' type view for all objects of 1 type, regardless of who deleted them). So far, I'm getting the deleted items with SOQL with ALL ROWS. However, I'd like to be able to do text search on these records. Is there a way to do that? In other words, is there an equivalent to 'ALL ROWS' for SOSL?
1 Answer
It appears in the docs that there is no such feature. The topic on the RETURNING
keyword lists all the allowed SOQL-like keywords, and `ALL ROWS is not in there.
SOSL is using a full-text-search index as its primary means of finding results. For efficiency, I would expect that we purge that index on "delete" of the record. Why keep all the extra dross of deleted data in the index, it would just confuse the search algorithms, slow down the search, reduce efficiency, etc.
A little test of trying to use ALL ROWS
in the developer console bears out the "it don't work" as I get a malformed query error.
-
1Yeah, I can't find anything in the docs either, unfortunately, I'm never sure if that means I haven't found it or that it does not exist ;)– LegolasJan 15, 2016 at 9:30
-
Additionally, the standard Recycle Bin does allow searching, so I wonder how that is done?– LegolasJan 15, 2016 at 9:32
-
I suspect it is that SOQL works even if the data is not indexed at all. "Recycle Bin" only means that the record is flagged as
isDeleted
, but still in the table. This means we can still issue a SOQL query and do a full table scan (at the very worst) even if the record is purged from every search index. But if the SOSL index is purged at delete, I would expect there is nothing for SOSL to find.– pchittumJan 15, 2016 at 9:42 -
Looking through the docs you linked, I can't see 'ALL ROWS' which is needed for SOQL documented there either? Or at least the search does not find it...– LegolasJan 19, 2016 at 9:49