Nov 8, 2010

Unusual behaviour with SOSL

Just encountered something strange working with SOSL would like to share with you all.

Suppose we have 5 records in Account with name 'Test', if I fire SOSL on Account (in system logs) :

"Find 'Test' IN ALL FIELDS RETURNING Account (id , Name)"

then it will return list of list of sObject with 5 records. Now by taking no time I change 1 record name from 'Test' to 'XYZ' and fire the same SOSL again. It still returns me 5 records of account. After 5-6 sec (some times 10 sec) without changing any data I fire the SOSL again, now it returns me 4 records of account. Looks strange, may be its a salesforce bug.


  1. Nice catch Ankit, it might be a caching issue on salesforce nodes.

  2. May be salesforce using Solr-Lucene search engine for SOSL for fast search.

    Please go through the links

  3. Yes Salesforce does use SOLR and it takes time for SOSL to get latest data because Salesforce update SOLR in async fashion after updating the main database.