Skip to main content
The Post Search API understands context and meaning, allowing users to find valuable content even when posts don’t contain exact keyword matches.

Key Features

Semantic Understanding

AI-powered search that comprehends context and meaning beyond exact text matches

Advanced Filtering

Filter by target type, post type, and parent-child relationships for precise results

Permission-Aware

Only returns posts from targets where the user has appropriate viewing permissions

Search Filtering Options

Target Filtering

Behavior: Searches across all accessible targets (communities and user feeds)Use Case: Comprehensive content discovery across the entire networkImplementation: Omit both targetType and targetId parametersPermission Scope: Only includes targets where user has view permissions
Behavior: Limits search to a single specified targetUse Case: Finding content within a specific community or user feedImplementation: Provide both targetType and targetId:
  • targetType: "community" + targetId: "communityId"
  • targetType: "user" + targetId: "userId"
Validation: Both parameters must be provided together

Post Type Filtering

  • All Post Types (Default)
  • Text Posts Only
  • Image Posts Only
  • Mixed Content
Description: Include all supported post types in search resultsSupported Types: Currently includes text and image postsBest For:
  • General content discovery
  • Comprehensive search results
  • Mixed content exploration

Parent-Child Relationship Filtering

Include All Posts (Default)

Setting: matchingOnlyParentPost: falseResults: Both parent posts and child posts (replies/comments)Use Cases:
  • Complete conversation discovery
  • Finding all related discussions
  • Comprehensive content analysis

Parent Posts Only

Setting: matchingOnlyParentPost: trueResults: Only top-level parent posts, excludes repliesUse Cases:
  • Main topic discovery
  • Original content focus
  • Reduced result noise

Implementation

// Search Options
let options = AmityPostSemanticSearchOptions(query: "Red Shoes", targetId: nil, targetType: nil, dataTypes: ["text","image"], matchingOnlyParentPost: true)

token = postRepository.semanticSearchPosts(options: options).observe({ liveCollection, _, error in
    
    let allPosts = liveCollection.allObjects()
    // ...
})

Limitations

  • Currently, the search only supports text and image posts; other post types are not included.
  • The search function only considers the context of individual posts. It does not consider the relationship between parent posts, their replies, or comments.