4

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.

2
  • 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
    Commented Feb 18, 2020 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
    Commented Feb 18, 2020 at 18:02

1 Answer 1

3

I found the answer and it is not a Salesforce issue. The issue is surrounding the Salesforce B2B (FKA CloudCraze) package and its 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 expected. This isn't well documented anywhere, so I'm hoping that this will save someone else hours of effort.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .