2

I am developing a search function for a community that has to implmenent a SOSL Query against multiple objects in order to return the accurate results. The issue I've run into is that when querying against a Text Area (255) field, and Long Text areas, when I search for a string it only works if the entire string is used.

This search will succceed and return the expected results

FIND 'Horse' IN ALL FIELDS RETURNING ccrz__E_ProductSpec__c(Id, Name, ccrz__SpecValue__c) WITH SPELL_CORRECTION = false

This SOSL query fails and returns no results

'FIND 'Hors*' IN ALL FIELDS RETURNING ccrz__E_ProductSpec__c(Id, Name, ccrz__SpecValue__c) WITH SPELL_CORRECTION = false'

The field values are long strings that sometimes contain just 'HORSE', but also could be a longer string. I've tried the * wildcard, as well as the ?, but neither of them works and no results are returned. Is there something I'm missing in the configuration, or is SOSL not going to work in the instance of searching text fields for values.

  • 1
    Do the text field(s) you're trying to search contain long, unbroken strings (like JSON)? If so, then that's a limitation of Salesforce's full-text indexing which I ran into in my own SOSL question – Derek F Feb 18 at 17:59
  • Nope, they contain individual words. For Example some of the searched records contain just "HORSE" while others contain longer strings of "HORSE, CATTLE, etc" – sevargdcg Feb 18 at 18:02
1

I found the answer and it is not a Salesforce issue. The issue is surrounding the Salesforce B2B (FKA CloudCraze) package and it's objects.

When overriding the search functionality I was looking at the B2B objects (ccrz__E_Product__c and ccrz__E_ProductSpec__c) instead of looking at the indexed objects (ccrz__E_ProductIndex__c and ccrz__E_ProductSpecIndex__c). When I switched to looking at the index objects, the search worked as anticiapted. This isn't well documented anywhere, so I'm hoping that this will save someone else hours of effort.

|improve this answer|||||

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.