Why do we see different search results on Mobile search box?
|Knowledge Article Number||000002866|
|Description||When mobile users submit a search via the side search box (essentially the closest possible equivalent to the online UI sidebar search), they are submitting a SOSL search query via the API. The SOSL query is essentially formulated by submitting a FIND statement and will search across ALL objects mobilized UNLESS the user specifically opened a specific tab i.e. ACCOUNT to limit the results.|
|Resolution||Admins, when building out custom fields such as external IDs, formula fields, etc. which references other fields on related to objects, can be indirectly affecting API-generated searches. This will affect how mobile and the core server process the search queries.
As for why search results appear in the UI, the sidebar and advanced search types do not search custom objects that do not have a tab associated with them. Therefore, the query through the UI simply does not include object/s with these types of references (similar to if you modified the SOSL query to exclude a specific custom object).
The API allows searching any object type you want (you're explicitly specifying them), so it does not exclude entities that do not have tabs.
SFDC also does not index related objects' information on the associated object. Therefore, a related object simply having a lookup to an object by which the user was actually looking for a specific piece of data i.e. ID field for example - this would NOT return related records within the search results.
If you want solid search results via mobile or other API searches, don't create unnecessary reference fields to other objects OR make sure that mobile users are specific in their searches from the device.