From ae542818abf233ec926d32363bd729d249745f66 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 24 Jun 2018 17:35:16 +0300 Subject: add search to api --- juick-server/src/main/java/com/juick/server/api/Messages.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'juick-server/src/main/java/com') diff --git a/juick-server/src/main/java/com/juick/server/api/Messages.java b/juick-server/src/main/java/com/juick/server/api/Messages.java index 35b7e6b2..36d3e1dd 100644 --- a/juick-server/src/main/java/com/juick/server/api/Messages.java +++ b/juick-server/src/main/java/com/juick/server/api/Messages.java @@ -20,6 +20,7 @@ package com.juick.server.api; import com.juick.Message; import com.juick.Tag; import com.juick.User; +import com.juick.server.Utils; import com.juick.server.component.MessageReadEvent; import com.juick.server.util.HttpBadRequestException; import com.juick.server.util.UserUtils; @@ -90,6 +91,7 @@ public class Messages { @RequestParam(required = false, defaultValue = "0") Integer daysback, @RequestParam(required = false) String withrecommended, @RequestParam(required = false) String popular, + @RequestParam(required = false) String search, @RequestParam(required = false) String media, @RequestParam(required = false) String tag) { @@ -112,6 +114,8 @@ public class Messages { mids = messagesService.getUserBlogWithRecommendations(user.getUid(), 0, before); } else if (daysback > 0) { mids = messagesService.getUserBlogAtDay(user.getUid(), 0, daysback); + } else if (!StringUtils.isEmpty(search)) { + mids = messagesService.getUserSearch(user.getUid(), Utils.encodeSphinx(search), 0, before); } else { mids = messagesService.getUserBlog(user.getUid(), 0, before); } @@ -130,6 +134,8 @@ public class Messages { } else { return NOT_FOUND; } + } else if (!StringUtils.isEmpty(search)) { + mids = messagesService.getSearch(Utils.encodeSphinx(search), before); } else { mids = messagesService.getAll(visitor.getUid(), before); } -- cgit v1.2.3