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, either community or user feed.

  • targetId: The ID of the designated target, i.e, community id when targetType is community; user id when targetType is user.

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 for text and image 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:

Text Post 1st: "I love ice cream."
Text Post 2nd: "Ice cream is my favorite dessert."
Text Post 3rd: "Nothing beats a scoop of ice cream on a hot day!"
Text Post 4th: "I enjoy trying different types of pastries."
Text Post 5th: "Cooking is a great way to relax after a long day."

Search for Text Posts

When the user searches for "ice cream," the output may include posts ranked by their relevance score. For example:

Text Post 1st: "I love ice cream."
Text Post 2nd: "Ice cream is my favorite dessert."
Text Post 3rd: "Nothing beats a scoop of ice cream on a hot day!"
Text Post 4th: "I enjoy trying different types of pastries."
Text Post 5th: "Cooking is a great way to relax after a long day."

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