You need to sign in to do that
Don't have an account?

How to Test the Document SOSL search?
Hi,
We have a SOSL request that goes threw the documents:
for(Document doc:(List<Document>)[FIND :keyword1 IN ALL FIELDS RETURNING Document(id)][0]){System.debug(doc);}
To test that we need to inser a Document object.
We use this code:
Document d = new Document(); d.Name = 'my text file'; String myContent = 'aabbcc'; d.Body = Blob.valueOf(myContent); d.ContentType = 'text/plain';d.Type = 'txt';insert d;
But the document is never retrieved by the SOSL request.
This works fine inside our project with Document uploaded threw the Document Tab.
We noticed that our document's field IsBodySearchable is false which might cause the problem.
But how to put it to true when you manually insert from a Test class?
Thanks,
Laurent
Read the 'Testing is tricky' link here.
Wes