From c549a5493b40aa639f9af898e1490344c0aa2b3b Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 1 Jun 2018 11:48:23 +0300 Subject: server: handmade SphinxSE query mapping --- .../src/main/java/com/juick/service/SphinxSearchService.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'juick-server-jdbc/src/main/java/com/juick') diff --git a/juick-server-jdbc/src/main/java/com/juick/service/SphinxSearchService.java b/juick-server-jdbc/src/main/java/com/juick/service/SphinxSearchService.java index d8330908..7de0680e 100644 --- a/juick-server-jdbc/src/main/java/com/juick/service/SphinxSearchService.java +++ b/juick-server-jdbc/src/main/java/com/juick/service/SphinxSearchService.java @@ -52,8 +52,9 @@ public class SphinxSearchService extends BaseJdbcService implements SearchServic } return getJdbcTemplate().queryForList( - "SELECT id FROM search WHERE query = '?;?'", Integer.class, searchString, - sphinxQuery.keySet().stream().map(Object::toString).collect(Collectors.joining(";"))); + String.format("SELECT id FROM search WHERE query = '%s;%s'", searchString, + sphinxQuery.keySet().stream().map(Object::toString) + .collect(Collectors.joining(";"))), Integer.class); } @Override @@ -69,9 +70,9 @@ public class SphinxSearchService extends BaseJdbcService implements SearchServic sphinxQuery.put("maxid", String.valueOf(messageIdBefore - 1)); } return getJdbcTemplate().queryForList( - "SELECT id FROM search WHERE query = '?;filter=user_id,?;?'", - Integer.class, searchString, userId, - sphinxQuery.keySet().stream().map(Object::toString).collect(Collectors.joining(";"))); + String.format("SELECT id FROM search WHERE query = '%s;%s;filter=user_id,%d'", searchString, + sphinxQuery.keySet().stream().map(Object::toString) + .collect(Collectors.joining(";")), userId), Integer.class); } @Override -- cgit v1.2.3