From 9e09af3ef7c3100e01937d26de430cd5de8b55fb Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 5 Jun 2020 11:58:58 +0300 Subject: Revert "Use default search mode for keywords" This reverts commit bbb06da27162385d147ef0ff78d787a4b2de6762. --- src/main/java/com/juick/service/SphinxSearchService.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/juick/service/SphinxSearchService.java b/src/main/java/com/juick/service/SphinxSearchService.java index 0e5634cc..4fa99c8a 100644 --- a/src/main/java/com/juick/service/SphinxSearchService.java +++ b/src/main/java/com/juick/service/SphinxSearchService.java @@ -51,10 +51,6 @@ public class SphinxSearchService extends BaseJdbcService implements SearchServic return "extended:@weight desc, @id desc"; } - String modeSwitch(String searchString) { - return isOneWord(searchString) ? "all": "any"; - } - String keywordBoost(String searchString) { return isOneWord(searchString) ? String.format("%s^3", searchString) : searchString; } @@ -66,7 +62,7 @@ public class SphinxSearchService extends BaseJdbcService implements SearchServic Map sphinxQuery = new HashMap<>(); sphinxQuery.put("limit", String.valueOf(maxResult)); - sphinxQuery.put("mode", modeSwitch(searchString)); + sphinxQuery.put("mode", "any"); sphinxQuery.put("sort", sortHint()); String usersFilter = userService.getUserBLUsers(visitor.getUid()).stream().map(u -> String.valueOf(u.getUid())).collect(Collectors.joining(",")); sphinxQuery.put("!filter", "user_id," + usersFilter); @@ -90,7 +86,7 @@ public class SphinxSearchService extends BaseJdbcService implements SearchServic Map sphinxQuery = new HashMap<>(); sphinxQuery.put("limit", String.valueOf(maxResult)); - sphinxQuery.put("mode", modeSwitch(searchString)); + sphinxQuery.put("mode", "any"); sphinxQuery.put("sort", sortHint()); if (page > 0) { sphinxQuery.put("offset", String.valueOf(page * maxResult)); -- cgit v1.2.3