Content Search V2 (Deprecated)
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
Search Posts
Search Posts API can be used to search and sort relevant posts created into social.plus. 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
(V2) Search posts by query as indicated in request JSON body
POST https://beta.amity.services/search/v2/posts
Headers
Authorization*
String
4GhW4Zkn5wyA
Request Body
query*
JSON
ksvJag3FnmK7
sort
JSON
DPUspUSAMciZ
from
Number
PQwGuNG9QW0L
size
Number
HPqjW34NqGXA
populatePostObject
Bool
2qk6tMD7d9su
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 intargetIdself- search all posts that belongs to the user passed inuserIdwithin 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.
Limitations
We currently do not support searching within a post’s metadata.
Last updated
Was this helpful?