function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Larry LeonidasLarry Leonidas 

SOSL ContentVersion Full-Text Search

I'm facing a problem trying to search for Content. We are basically trying to return search results using SOSL on the ContentVersion object. We're expecting full-text search results (words within the PDF or DOC), but results are returned only on ContentVersion.Title.


List<List<SObject>> contentresults1 = [FIND :SearchVal IN ALL FIELDS RETURNING ContentVersion (id, Title, Description)];


You might be out-of-luck. The VersionData field is base64 encoded through the API, so you will not be able to do a plain-text search on that field.

Larry LeonidasLarry Leonidas

Thanks for the response. Salesforce does handle this within their Global Search feature, so an index is being maintained, wonder how this can be leveraged in Apex?




I'm interested in this as well. Did anyone find a way via APEX or the API to do a full-text search of content?


I'm trying to do the same. Did anyone figure this out?


In this thread one of the PMs indicates that document content (at least some of it) is indexed and in scope for SOSL search.

Larry LeonidasLarry Leonidas

Thanks for linking the other post. We're still trying to figure this one out.