Intelligent Search - Post
Introduction
The Intelligent Search Post API allows users to search for communities with advanced filtering options. The search includes all targets where the user has permission to view posts. However, you can refine the results using specific filters for target types, target IDs, post types, or parent-child relationships.
Target Filtering
By default, the search will include all targets where the user can view posts. However, you can narrow the search scope to a specific target by specifying both the targetType
and targetId
together.
targetType
: Defines the type of target where the post was created, eithercommunity
oruser
feed.targetId
: The ID of the designated target, i.e, community id whentargetType
iscommunity
; user id whentargetType
isuser
.
Post Filtering
You can choose to filter specific post types or based on parent-child relationships.
matchingOnlyParentPost
When set to
true
, only parent posts are included, excluding child posts from the search.When set to
false
, both parent and child posts are included in the search.
postTypes
: Filters posts by type. Currently supports filtering fortext
andimage
posts.
Example Use Cases
Search for Text Posts
When the user searches for "ice cream," the output may include posts ranked by their relevance score. For example:
Search for Text Posts
When the user searches for "ice cream," the output may include posts ranked by their relevance score. For example:
Search for Image Posts
When the user searches for "ice cream," the output may include posts ranked by their relevance score. For example:
The following code snippet demonstrates how to search for text and image posts across the entire network. Users can filter the results to display only text, images, or both, depending on their preference.
Limitations
The search function only considers the context of individual posts. It does not consider the relationship between parent posts, their replies, or comments.
Currently, the search only supports text and image posts; other post types are not included.
Last updated