[SalesForce] Filtering by Long Text Area field in SOQL

I'm working on a custom search page, which will search through the fields of the Project object. I use dynamic SOQL query similar to that:

String query = 'SELECT Name, Status__c ... 
    FROM Project__c WHERE Name LIKE \'%' + String.escapeSingleQuotes(name)
     +'%\' + ' OR Status__c = \'' + String.escapeSingleQuotes(status) +'\'';
List<Project__c> projects = Database.query(query);

But when I try to add to filter criteria Description__c field, which is Long Text Area, get the following error:

System.QueryException: field 'Description__c' can not be filtered in query call

How can I use Long Text Area fields in filtering of results?

Best Answer

You can not use text area fields in SOQL and SOSL filter criterias.

Try this approach:

List<Project__c> projects = new List<Project__c>();
for(Project__c proj : [SELECT Name, Status__c, Description__c FROM Project__c WHERE Name LIKE '%' + String.escapeSingleQuotes(name) +'%' + OR Status__c = String.escapeSingleQuotes(status)]) {
    if(proj.Description__c.contains('filter string')) {
        projects.add(proj);
    }
}