From 85c5c69ffb5a14258eafb4c67c550f6018b3c621 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 5 Jun 2020 12:17:52 +0300 Subject: Append * to keyword search --- src/main/java/com/juick/www/api/Messages.java | 4 ++-- src/main/java/com/juick/www/controllers/Site.java | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src/main/java/com/juick/www') diff --git a/src/main/java/com/juick/www/api/Messages.java b/src/main/java/com/juick/www/api/Messages.java index de29c78c..29c4c0ba 100644 --- a/src/main/java/com/juick/www/api/Messages.java +++ b/src/main/java/com/juick/www/api/Messages.java @@ -119,7 +119,7 @@ public class Messages { } else if (daysback > 0) { mids = messagesService.getUserBlogAtDay(user.getUid(), 0, daysback); } else if (!StringUtils.isEmpty(search)) { - mids = messagesService.getUserSearch(visitor, user.getUid(), WebUtils.encodeSphinx(search), 0, page); + mids = messagesService.getUserSearch(visitor, user.getUid(), WebUtils.encodeSphinx(search), 0, page, false); } else { mids = messagesService.getUserBlog(user.getUid(), 0, before); } @@ -139,7 +139,7 @@ public class Messages { return NOT_FOUND; } } else if (!StringUtils.isEmpty(search)) { - mids = messagesService.getSearch(visitor, WebUtils.encodeSphinx(search), page); + mids = messagesService.getSearch(visitor, WebUtils.encodeSphinx(search), page, false); } else { mids = messagesService.getAll(visitor.getUid(), before); } diff --git a/src/main/java/com/juick/www/controllers/Site.java b/src/main/java/com/juick/www/controllers/Site.java index 537b0a6e..00b47000 100644 --- a/src/main/java/com/juick/www/controllers/Site.java +++ b/src/main/java/com/juick/www/controllers/Site.java @@ -108,7 +108,7 @@ public class Site { if (paramSearch != null) { title = "Поиск: " + StringEscapeUtils.escapeHtml4(paramSearch); - mids = messagesService.getSearch(visitor, WebUtils.encodeSphinx(paramSearch), page); + mids = messagesService.getSearch(visitor, WebUtils.encodeSphinx(paramSearch), page, false); } else if (paramShow == null) { title = "Обсуждения"; mids = messagesService.getDiscussions(visitor.getUid(), paramTo); @@ -194,8 +194,11 @@ public class Site { List mids; + boolean isTagSearch = false; + if (paramTagStr != null) { paramSearch = paramTagStr; + isTagSearch = true; } if (paramSearch != null && paramSearch.length() > 64) { paramSearch = null; @@ -214,7 +217,8 @@ public class Site { if (paramShow == null) { if (paramSearch != null) { title = "Блог " + user.getName() + ": " + StringEscapeUtils.escapeHtml4(paramSearch); - mids = messagesService.getUserSearch(visitor, user.getUid(), WebUtils.encodeSphinx(paramSearch), privacy, page); + mids = messagesService.getUserSearch(visitor, user.getUid(), WebUtils.encodeSphinx(paramSearch), + privacy, page, isTagSearch); } else { title = "Блог " + user.getName(); mids = messagesService.getUserBlog(user.getUid(), privacy, before); -- cgit v1.2.3