aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2020-06-05 11:59:05 +0300
committerGravatar Vitaly Takmazov2020-06-05 11:59:05 +0300
commit9297e1dc40bfa9e05fc598403f224270f10c9154 (patch)
tree1e8e857429cb3d5e8eabd626fb923bab9283b1e6 /src
parent9e09af3ef7c3100e01937d26de430cd5de8b55fb (diff)
Revert "Fix sort hint"
This reverts commit 9e5c7c562f93b4156c77fbc5ebab91a245001eb3.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/juick/service/SphinxSearchService.java10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/main/java/com/juick/service/SphinxSearchService.java b/src/main/java/com/juick/service/SphinxSearchService.java
index 4fa99c8a..aa62ddda 100644
--- a/src/main/java/com/juick/service/SphinxSearchService.java
+++ b/src/main/java/com/juick/service/SphinxSearchService.java
@@ -47,11 +47,7 @@ public class SphinxSearchService extends BaseJdbcService implements SearchServic
return searchString.split("[^\\S\\+]+").length == 1;
}
- String sortHint() {
- return "extended:@weight desc, @id desc";
- }
-
- String keywordBoost(String searchString) {
+ public String keywordBoost(String searchString) {
return isOneWord(searchString) ? String.format("%s^3", searchString) : searchString;
}
@@ -63,7 +59,7 @@ public class SphinxSearchService extends BaseJdbcService implements SearchServic
Map<String, String> sphinxQuery = new HashMap<>();
sphinxQuery.put("limit", String.valueOf(maxResult));
sphinxQuery.put("mode", "any");
- sphinxQuery.put("sort", sortHint());
+ sphinxQuery.put("sort", "extended:@weight desc, @id desc");
String usersFilter = userService.getUserBLUsers(visitor.getUid()).stream().map(u -> String.valueOf(u.getUid())).collect(Collectors.joining(","));
sphinxQuery.put("!filter", "user_id," + usersFilter);
if (isOneWord(searchString)) {
@@ -87,7 +83,7 @@ public class SphinxSearchService extends BaseJdbcService implements SearchServic
Map<String, String> sphinxQuery = new HashMap<>();
sphinxQuery.put("limit", String.valueOf(maxResult));
sphinxQuery.put("mode", "any");
- sphinxQuery.put("sort", sortHint());
+ sphinxQuery.put("sort", sortHint(searchString));
if (page > 0) {
sphinxQuery.put("offset", String.valueOf(page * maxResult));
}