aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-07-16 15:53:38 +0300
committerGravatar Vitaly Takmazov2018-07-16 15:53:38 +0300
commit6afdad578701d38dd45d7d1c8ef446269f3a1275 (patch)
treec8259c0b047523b0b6035a8a1a2daa3a9016bb46 /juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
parenta8a32a0957ea014b1204b037164cb7d53cccd0c7 (diff)
sphinx search: page by offset
Diffstat (limited to 'juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java')
-rw-r--r--juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java24
1 files changed, 4 insertions, 20 deletions
diff --git a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
index d64ecc04..a78c9203 100644
--- a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -628,15 +628,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
@Transactional(readOnly = true)
@Override
- public List<Integer> getSearch(final String search, final int before) {
- List<Integer> mids = searchService.searchInAllMessages(search, before);
-
- if (!mids.isEmpty())
- return getNamedParameterJdbcTemplate().queryForList(
- "SELECT message_id FROM messages WHERE message_id IN (:ids) AND privacy > 0 ORDER BY message_id DESC LIMIT 20",
- new MapSqlParameterSource("ids", mids),
- Integer.class);
- return mids;
+ public List<Integer> getSearch(final String search, final int page) {
+ return searchService.searchInAllMessages(search, page);
}
@Transactional(readOnly = true)
@@ -755,17 +748,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
@Transactional(readOnly = true)
@Override
- public List<Integer> getUserSearch(final int UID, final String search, final int privacy, final int before) {
- List<Integer> mids = searchService.searchByStringAndUser(search, UID, before);
-
- if (!mids.isEmpty()) {
- return getNamedParameterJdbcTemplate().queryForList(
- "SELECT message_id FROM messages WHERE message_id IN (:ids) AND privacy >= :privacy ORDER BY message_id DESC",
- new MapSqlParameterSource("ids", mids)
- .addValue("privacy", privacy),
- Integer.class);
- }
- return mids;
+ public List<Integer> getUserSearch(final int UID, final String search, final int privacy, final int page) {
+ return searchService.searchByStringAndUser(search, UID, page);
}
@Transactional(readOnly = true)