Content Search
Content Search allows you to perform more complex content searching and sorting. The feature can be used for the following use cases:
Search post by text content
Find posts that contain a specific hashtag
Sort post by last activity or reaction count
Content Search is currently in Private Beta. Please submit your request to Amity Help Center to enable this feature. It will take approximately 5 business days to process your request.
Search Posts
Search Posts API can be used to search and sort relevant posts created into Amity Social. All APIs will return sorted list of post IDs that contains relevant contents.
API Reference
(V2) Search posts by query as indicated in request JSON body
POST
https://beta.amity.services/search/v2/posts
Headers
Authorization*
String
Bearer {accessToken}
(accessToken is retrieved from Amity SDK)
Request Body
query*
JSON
sort
JSON
from
Number
Offset from the first result to be fetched
size
Number
Maximum amount of IDs to be returned
populatePostObject
Bool
Include post object in response or not?
When populatePostObject
is set to true
, the posts object will be retrieved from the API separately and will not be cached within the SDK. If the user wants to subscribe to the post object and use LiveObject/LiveCollection, they should use getList from the SDK.
Query JSON
query
is a JSON object that indicates the posts to be searched for. The following is the full JSON structure with all the fields:
All fields are optional. If targetId
is present the system will search for posts on those communities. If targetId
is not specified the system will search for all posts created by userId
calling the API.
For Search V2:
targetType
can be the following values:
community
- search posts in all communities ID as defined intargetId
self
- search all posts that belongs to the user passed inuserId
within request bodypublic
- search all posts that is in all public communities
Limitations
Current limitations on Search Posts API are
Posts created on user feed is not yet searchable.
Query & Sort Format
NumberQuery
NumberQuery JSON structure defines range of numerical value to look for in a property. Available fields within the JSON structure are:
TimeQuery
TimeQuery JSON structure defines range of date time value to look for in a property. Available fields within the JSON structure are:
Time string in TimeQuery must be in ISO Date Format: YYYY-MM-DDThh:mm:ss.sZ
Sort JSON
sort
is a JSON array that indicates how should the returning contents be sorted. The following is the full JSON structure:
The returning content IDs will be sorted by the sort priority defined in Sort JSON. sort_field
is the field the post should be sorted by - this can be any of the field Query JSON that is in NumberQuery or TimeQuery format.
Last updated