0

We have the following SOSL query to find financial transactions:

List> searchList = [FIND :searchTerm IN ALL FIELDS RETURNING Financial_Transactions__c (Financial_Account__r.Nickname__c, Financial_Account__r.Name, Transaction_Date__c, Merchant_Name__c,Original_Description__c, Date__c,Security_Symbol__c,Category__c,Transaction_Type__c,Quantity__c,Price__c,Amount__c where (Financial_Account__c=:mappingOfValues.get('id') and Financial_Account__r.Status__c NOT IN ('Pending Delete') and Date__c>=:fromDate and Date__c <=:toDate) ORDER BY Date__c DESC LIMIT 500 OFFSET :offSetCalc)];

It would return amounts of $233, $2343, $5656 for respective records. When I search for any of the amounts nothing gets returned. And I did specify IN ALL FIELDS in my SOQL query so it should be returning those records.

Is it because SOSL does not search on numeric fields?What would be a way to solve this?

  • 1
    Why not just use SOQL? – Adrian Larson Dec 12 '16 at 21:01
  • "ALL" is a bit deceptive. It means "search all fields that can be searched," not "search every field in every object", which is different. This is in contrast to things like "NAME" that searches just name fields, etc. The answer provided is correct; you'd have to put your numbers into a text field somewhere if you wanted to use SOSL. – sfdcfox Dec 12 '16 at 21:27
5

Correct. Per the Developer's Guide, SOSL is for "text-based search queries". On the FIND page, it also says in many ways that it is for words or phrases.

If you have a number inside of a text field, it does work. Example "I want 6000 pizzas delivered" in a comment field of type textarea. find {6000} in all fields returning Object__c (comment__c) will hit on that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.