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

Post Type Filtering

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.