diff options
Diffstat (limited to 'juick-server/src/main/java/com/juick/service/SphinxSearchService.java')
-rw-r--r-- | juick-server/src/main/java/com/juick/service/SphinxSearchService.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/juick-server/src/main/java/com/juick/service/SphinxSearchService.java b/juick-server/src/main/java/com/juick/service/SphinxSearchService.java index f2f31295..da27196f 100644 --- a/juick-server/src/main/java/com/juick/service/SphinxSearchService.java +++ b/juick-server/src/main/java/com/juick/service/SphinxSearchService.java @@ -39,7 +39,7 @@ public class SphinxSearchService extends BaseJdbcService implements SearchServic private int maxResult = DEFAULT_MAX_RESULT; @Override - public List<Integer> searchInAllMessages(final String searchString, final int messageIdBefore) { + public List<Integer> searchInAllMessages(final String searchString, final int page) { if (StringUtils.isBlank(searchString)) return Collections.emptyList(); @@ -47,8 +47,8 @@ public class SphinxSearchService extends BaseJdbcService implements SearchServic sphinxQuery.put("limit", String.valueOf(maxResult)); sphinxQuery.put("mode", "any"); sphinxQuery.put("sort", "extended:@weight desc, @id desc"); - if (messageIdBefore > 0) { - sphinxQuery.put("maxid", String.valueOf(messageIdBefore - 1)); + if (page > 0) { + sphinxQuery.put("offset", String.valueOf(page * maxResult)); } return getJdbcTemplate().queryForList( @@ -58,7 +58,7 @@ public class SphinxSearchService extends BaseJdbcService implements SearchServic } @Override - public List<Integer> searchByStringAndUser(final String searchString, final int userId, int messageIdBefore) { + public List<Integer> searchByStringAndUser(final String searchString, final int userId, int page) { if (StringUtils.isBlank(searchString)) return Collections.emptyList(); @@ -66,8 +66,8 @@ public class SphinxSearchService extends BaseJdbcService implements SearchServic sphinxQuery.put("limit", String.valueOf(maxResult)); sphinxQuery.put("mode", "any"); sphinxQuery.put("sort", "extended:@weight desc, @id desc"); - if (messageIdBefore > 0) { - sphinxQuery.put("maxid", String.valueOf(messageIdBefore - 1)); + if (page > 0) { + sphinxQuery.put("offset", String.valueOf(page * maxResult)); } return getJdbcTemplate().queryForList( String.format("SELECT id FROM search WHERE query = '%s;%s;filter=user_id,%d'", searchString, |