aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/juick/service/PostgresSearchService.java11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/main/java/com/juick/service/PostgresSearchService.java b/src/main/java/com/juick/service/PostgresSearchService.java
index 2493a45ef..79986670a 100644
--- a/src/main/java/com/juick/service/PostgresSearchService.java
+++ b/src/main/java/com/juick/service/PostgresSearchService.java
@@ -30,6 +30,7 @@ import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.Collections;
import java.util.List;
+import java.util.stream.Collectors;
/**
* Created by aalexeev on 11/18/16.
@@ -85,17 +86,13 @@ public class PostgresSearchService extends BaseJdbcService implements SearchServ
"""
ORDER BY
"""
- + (isOneWord ? "message_id DESC" : "ts_rank_cd(v, q) DESC, message_id DESC") +
- """
- LIMIT :limit OFFSET :offset
- """;
+ + (isOneWord ? "message_id DESC" : "ts_rank_cd(v, q) DESC, message_id DESC");
return getNamedParameterJdbcTemplate().queryForList(sql,
new MapSqlParameterSource()
.addValue("query", escapeQuery(searchString))
.addValue("user_id", userId)
- .addValue("filter", usersFilter)
- .addValue("limit", maxResult)
- .addValue("offset", offset), Integer.class);
+ .addValue("filter", usersFilter), Integer.class).stream()
+ .skip(offset).limit(maxResult).collect(Collectors.toList());
}
@Override