5

I am trying to query for FeedItems that belong to a specific community as follows:

FIND {searchTerm} RETURNING FeedItem(Id,Title,Body) WITH NETWORK IN ('SomeID')

However, I noticed that the query returns feedItems that also have a NetworkScope of 'AllNetworks' (feed item is available in all communities). however, when I specify in a SOQL

Select ID from FeedItem where Networkscope='SomeID' 

the appropriate FeedItems are returned.

I have also tried using: WITH NETWORK = 'SomeID', but to no avail

The documentation in regards to querying WITH NETWORK NetworkIdSpec can be found here

Another important note, from the SOAP API Doc:

Note the following exceptions for NetworkScope:

  • Only feed items with a Group or User parent can set a NetworkId or a null
    value for NetworkScope.
  • For feed items with a record parent, users can set NetworkScope only to AllNetworks.
  • You can’t filter a FeedItem on the NetworkScope field.

not sure what the documentation means by the last point:

You can’t filter a FeedItem on the NetworkScope field.

As in SOQL I seem to be able to filter by it.

Could someone explain why FeedItems with the AllNetworks Network scope are appearing in my SOSL and not in my SOQL?

What would be the best way to filter on FeedItems in my community using SOSL while excluding feeditems with networkscope = AllNetworks?

2
  • Hi. Have you tried FIND {searchTerm} RETURNING FeedItem(Id,Title,Body WHERE NetworkId IN ('SomeID') ) ?
    – Patlatus
    Nov 15, 2017 at 21:47
  • yup, however, networkid is not a column in the DB, just a value of networkscope.
    – glls
    Nov 17, 2017 at 16:09

1 Answer 1

0

After further testing, the only SOSL that I managed to forumulate in order to exclude the NetworkScope 'AllNetworks' from my query results was:

FIND {searchTerm} RETURNING FeedItem(Title,body,type,NetworkScope,Parent.Name WHERE NETWORKSCOPE !='AllNetworks') WITH NETWORK = 'NetworkId'

I had to add a where clause to exclude 'AllNetworks'.

which is coutnerintuitive since the documentation states the following:

To search the NetworkId community for users and feed items containing x string :

FIND {test} RETURNING User (id), FeedItem (id, ParentId WHERE CreatedDate = THIS_YEAR Order by CreatedDate DESC) WITH NETWORK = 'NetworkId'

OR

To search multiple communities for users and feed items containing x string:

FIND {test} RETURNING User (id), FeedItem (id, ParentId WHERE CreatedDate = THIS_YEAR Order by CreatedDate DESC) WITH NETWORK IN ('NetworkId1', 'NetworkId2', 'NetworkId3')

which seem to indicate searching in the specified communities, not posts made outside those communities which have a scope AllNetworks'.

I did not find any documentation further drilling into this subject unfortunately. If I do, I will update this post accordingly.

The following sosl kind of threw me off while testing:

FIND {searchTerm} RETURNING FeedItem(Title,body WHERE NETWORKSCOPE NOT IN ('myNetworkId')) WITH NETWORK IN ('myNetworkId')

will return results with NetworkScope 'AllNetworks' only =/

You must log in to answer this question.

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