diff options
author | Vitaly Takmazov | 2018-06-24 17:35:16 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-06-24 17:35:16 +0300 |
commit | ae542818abf233ec926d32363bd729d249745f66 (patch) | |
tree | f6e640c4c5db9fc443468d9a7cece25ed37f06df | |
parent | 03ce72458996d895d0780e1c41316dd2819b02f2 (diff) |
add search to api
-rw-r--r-- | juick-server/src/main/java/com/juick/server/api/Messages.java | 6 |
1 files changed, 6 insertions, 0 deletions
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); } |