Skip to content

Commit

Permalink
Merge pull request #814 from pocketnetteam:rpc/search-only-videos
Browse files Browse the repository at this point in the history
feat: implement video search functionality in SearchRpc
  • Loading branch information
andyoknen authored Jan 23, 2025
2 parents 88739ba + b8791c7 commit 9082553
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/pocketdb/web/SearchRpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,28 @@ namespace PocketWeb::PocketWebRpc
result.At("posts").pushKV("data", data);
}

// Search videos in caption, message and urls
if (type == "videos")
{
searchRequest.TxTypes = { CONTENT_VIDEO };
searchRequest.FieldTypes = {
ContentFieldType_ContentVideoCaption,
ContentFieldType_ContentVideoMessage,
};

// Search
auto ids = request.DbConnection()->SearchRepoInst->SearchIds(searchRequest);

// Get content data
auto contents = request.DbConnection()->WebRpcRepoInst->GetContentsData({}, ids, searchRequest.Address);

UniValue data(UniValue::VARR);
data.push_backV(contents);

result.pushKV("posts", UniValue(UniValue::VOBJ));
result.At("posts").pushKV("data", data);
}

// Get all videos with requested link
if (type == "videolink")
{
Expand Down

0 comments on commit 9082553

Please sign in to comment.