diff options
author | Vitaly Takmazov | 2020-06-05 11:59:14 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2020-06-05 11:59:14 +0300 |
commit | 47225702228c92f2d8ecde59ad6c17790acd228d (patch) | |
tree | 4803bd676455e189a0c97dc05f286948c2b53957 /src/main/java | |
parent | 097066de58c04965c50da20db35aa5d81c54d7e7 (diff) |
Revert "boost keyword weight on search"
This reverts commit dde18e12688a47f81cb7c4336901008158a3637e.
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/juick/service/SphinxSearchService.java | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/main/java/com/juick/service/SphinxSearchService.java b/src/main/java/com/juick/service/SphinxSearchService.java index 1553e22f..dd06c485 100644 --- a/src/main/java/com/juick/service/SphinxSearchService.java +++ b/src/main/java/com/juick/service/SphinxSearchService.java @@ -44,11 +44,8 @@ public class SphinxSearchService extends BaseJdbcService implements SearchServic UserService userService; public String sortHint(String searchString) { - return "extended:@weight desc, @id desc"; - } - public String keywordBoost(String searchString) { boolean isOneWord = searchString.split("[^\\S\\+]+").length == 1; - return isOneWord ? String.format("%s^3", searchString) : searchString; + return isOneWord ? "extended:@id desc" : "extended:@weight desc, @id desc"; } @Override @@ -67,7 +64,7 @@ public class SphinxSearchService extends BaseJdbcService implements SearchServic } return getJdbcTemplate().queryForList( - String.format("SELECT id FROM search WHERE query = '%s;%s'", keywordBoost(searchString), + String.format("SELECT id FROM search WHERE query = '%s;%s'", searchString, sphinxQuery.entrySet().stream().map(Object::toString) .collect(Collectors.joining(";"))), Integer.class); } |