Search for Feeds
The query feeds endpoint lets you search for feeds.
Examples
Querying My Feeds
val query = FeedsQuery(
filter = FeedsFilterField.createdById.equal("john"),
sort = listOf(FeedsSort(FeedsSortField.CreatedAt, SortDirection.REVERSE)),
limit = 10,
watch = true
)
val feedList = client.feedList(query = query)
// Page 1
val page1: Result<List<FeedData>> = feedList.get()
// Page 2
val page2: Result<List<FeedData>> = feedList.queryMoreFeeds(limit = 10)
val page1And2 = feedList.state.feeds// First page query
Map<String, Object> filter = new HashMap<>();
filter.put("created_by_id", "john");
QueryFeedsRequest firstPageRequest = QueryFeedsRequest.builder()
.filter(filter)
.limit(10)
.sort(List.of(
SortParamRequest.builder()
.field("created_at")
.direction(-1)
.build()
))
.build();
QueryFeedsResponse firstPage = feeds.queryFeeds(firstPageRequest).execute().getData();
// Second page using next cursor from first page
QueryFeedsRequest secondPageRequest = QueryFeedsRequest.builder()
.filter(filter)
.limit(10)
.sort(List.of(
SortParamRequest.builder()
.field("created_at")
.direction(-1)
.build()
))
.next(firstPage.getNext())
.build();
QueryFeedsResponse secondPage = feeds.queryFeeds(secondPageRequest).execute().getData();Querying Feeds Where I Am a Member
val query = FeedsQuery(
filter = FeedsFilterField.members.contains("john")
)
val feedList = client.feedList(query = query)
val feeds: Result<List<FeedData>> = feedList.get()Map<String, Object> filter = new HashMap<>();
Map<String, Object> membersFilter = new HashMap<>();
membersFilter.put("$in", List.of("john"));
filter.put("members", membersFilter);
QueryFeedsRequest request = QueryFeedsRequest.builder()
.filter(filter)
.build();
QueryFeedsResponse response = feeds.queryFeeds(request).execute().getData();Querying feeds by name or description
val sportsQuery = FeedsQuery(
filter = Filters.and(
FeedsFilterField.visibility.equal("public"),
FeedsFilterField.name.query("Sports")
)
)
val sportsFeedList = client.feedList(query = sportsQuery)
val sportsFeeds: Result<List<FeedData>> = sportsFeedList.get()
val techQuery = FeedsQuery(
filter = Filters.and(
FeedsFilterField.visibility.equal("public"),
FeedsFilterField.description.query("tech")
)
)
val techFeedList = client.feedList(query = techQuery)
val techFeeds: Result<List<FeedData>> = techFeedList.get()// Search public feeds by name
Map<String, Object> filter1 = new HashMap<>();
filter1.put("visibility", Map.of("$eq", "public"));
filter1.put("name", Map.of("$q", "Sports"));
QueryFeedsRequest request1 = QueryFeedsRequest.builder()
.filter(filter1)
.build();
QueryFeedsResponse response1 = feeds.queryFeeds(request1).execute().getData();
// Search public feeds by description
Map<String, Object> filter2 = new HashMap<>();
filter2.put("visibility", "public");
filter2.put("description", Map.of("$q", "tech"));
QueryFeedsRequest request2 = QueryFeedsRequest.builder()
.filter(filter2)
.build();
QueryFeedsResponse response2 = feeds.queryFeeds(request2).execute().getData();Querying feeds by creator name
val query = FeedsQuery(
filter = Filters.and(
FeedsFilterField.visibility.equal("public"),
FeedsFilterField.createdByName.query("Thompson"),
)
)
val feedList = client.feedList(query = query)
val feeds: Result<List<FeedData>> = feedList.get()// Search public feeds created by users with 'Thompson' in their name
Map<String, Object> filter = new HashMap<>();
filter.put("visibility", "public");
filter.put("created_by.name", Map.of("$q", "Thompson"));
QueryFeedsRequest request = QueryFeedsRequest.builder()
.filter(filter)
.build();
QueryFeedsResponse response = feeds.queryFeeds(request).execute().getData();A complex example
Search for user feeds where text matches the feed's name, description or creator's name:
val query = FeedsQuery(
filter = Filters.and(
FeedsFilterField.groupId.equal("user"),
Filters.or(
FeedsFilterField.name.query(searchQuery),
FeedsFilterField.description.query(searchQuery),
FeedsFilterField.createdByName.query(searchQuery)
)
)
)
val feedList = client.feedList(query = query)
val feeds: Result<List<FeedData>> = feedList.get()Map<String, Object> filter = new HashMap<>();
filter.put("group_id", "user");
filter.put("$or", List.of(
Map.of("name", Map.of("$q", searchQuery)),
Map.of("description", Map.of("$q", searchQuery)),
Map.of("created_by.name", Map.of("$q", searchQuery))
));
QueryFeedsRequest request = QueryFeedsRequest.builder()
.filter(filter)
.build();
QueryFeedsResponse response = feeds.queryFeeds(request).execute().getData();Feeds Queryable Built-in Fields
| name | type | description | supported operations | example |
|---|---|---|---|---|
id |
string or list of strings | The ID of the feed | $in, $eq |
{ id: { $in: [ 'abc', 'xyz' ] } } |
group_id |
string or list of strings | The ID of the group this feed belongs to | $in, $eq |
{ group_id: { $in: [ 'abc', 'xyz' ] } } |
feed |
string or list of strings | The fully qualified feed ID (group_id:id) | $in, $eq |
{ fid: { $in: [ 'abc', 'xyz' ] } } |
visibility |
string or list of strings | The visibility setting of the feed | $in, $eq |
{ visibility: { $eq: 'public' } } |
created_by_id |
string or list of strings | The ID of the user who created the feed | $in, $eq |
{ created_by_id: { $in: [ 'abc', 'xyz' ] } } |
created_by.name |
string | The name of the user who created the feed | $eq, $q, $autocomplete |
{ 'created_by.name': { $autocomplete: 'Frank' } } |
name |
string | The name of the feed | $eq, $q, $autocomplete |
{ name: { $q: 'Sports' } } |
description |
string | The description of the feed | $eq, $q, $autocomplete |
{ description: { $autocomplete: 'tech' } } |
member_count |
number | The number of accepted members in this feed (pending and declined invitations are not counted) | $eq, $ne, $gt, $lt, $gte, $lte |
{ member_count: { $gt: 100 } } |
members |
list of strings | The list of members in this feed | $in |
{ members: { $in: [ 'bob', 'alice' ] } } |
following_count |
number | The number of feeds this feed follows | $eq, $ne, $gt, $lt, $gte, $lte |
{ following_count: { $gt: 100 } } |
following_feeds |
list of strings | The list of feeds this feed follows | $in |
{ following_feeds: { $in: [ 'feed1', 'feed2' ] } } |
follower_count |
number | The number of followers of this feed | $eq, $ne, $gt, $lt, $gte, $lte |
{ follower_count: { $gt: 100 } } |
created_at |
string, RFC3339 timestamp | The time the feed was created | $eq, $gt, $lt, $gte, $lte |
{ created_at: { $gte: '2023-12-04T09:30:20.45Z' } } |
updated_at |
string, RFC3339 timestamp | The time the feed was updated | $eq, $gt, $lt, $gte, $lte |
{ updated_at: { $gte: '2023-12-04T09:30:20.45Z' } } |
filter_tags |
list of strings | Tags for filtering the feed | $eq, $contains, $in |
{ filter_tags: { $in: [ 'sports', 'news' ] } } |
near |
object | GEO point and distance (km) to filter by | $eq |
{ near: { $eq: { lat: 40.0, lng: -74.0, distance: 200 } } } |
within_bounds |
object | GEO bounding box to filter by | $eq |
{ within_bounds: { $eq: { ne_lat: 40.0, ne_lng: -115.0, sw_lat: 32.0, sw_lng: -125.0 } } } |
Filter expressions can be combined using $or and $and operators as well.
Feeds can be sorted by created_at, updated_at, member_count, follower_count, and following_count.
Be sure to reach out to support if you need additional query feed capabilities.