Newer Version Available
WITH NETWORK NetworkIdSpec
You can search for community users and feeds by using the WITH NETWORK optional clause on a SOSL query. When you’re filtering search results
by community, each
community is
represented by a community ID (NetworkId).
You can use the following syntax.
- WITH NETWORK IN (’NetworkId1', ’NetworkId2', ...) supports filtering by one or more communities.
- WITH NETWORK = ’NetworkId' supports filtering by a single community only.
For objects other than users and feeds, search results include matches across all communities
and internal company data, even if you use network filtering in your query.
- You can run searches against multiple objects in the same community.
- You can’t run scoped and unscoped searches in the same query. For example, you can’t search users from a community along with accounts from the entire organization.
To filter search results for groups or topics by community, use the WHERE clause with a NetworkId value. If you want to search for an internal community, use an all zero value for NetworkId.
Example WITH NETWORK NetworkIdSpec Clauses
To search multiple communities for users
and feed items containing the string “test” and to sort feed items from the
newest to the
oldest:
1FIND {test} RETURNING User (id),
2 FeedItem (id, ParentId WHERE CreatedDate =
3 THIS_YEAR Order by CreatedDate DESC)
4 WITH NETWORK IN ('NetworkId1', 'NetworkId2', 'NetworkId3')To search the NetworkId community for users and feed items containing the string “test” and to sort feed items from the newest to the oldest:
1FIND {test} RETURNING User (id),
2 FeedItem (id, ParentId WHERE CreatedDate =
3 THIS_YEAR Order by CreatedDate DESC)
4 WITH NETWORK = 'NetworkId'To search in an internal community for users and feed items containing the string “test” and to sort feed items from newest to oldest:
1FIND {test} RETURNING User (id),
2 FeedItem (id, ParentId WHERE CreatedDate =
3 THIS_YEAR Order by CreatedDate DESC)
4 WITH NETWORK = '00000000000000'