aboutsummaryrefslogtreecommitdiff
path: root/juick-server-jdbc/src/main/java/com/juick/service/SphinxSearchService.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-06-01 11:48:23 +0300
committerGravatar Vitaly Takmazov2018-06-01 11:48:23 +0300
commitc549a5493b40aa639f9af898e1490344c0aa2b3b (patch)
treebff658e9ba703ddfb26a1d06ceac87c82e7c8157 /juick-server-jdbc/src/main/java/com/juick/service/SphinxSearchService.java
parent84b2f994bd9b6b46155dda5953922cc0882c6514 (diff)
server: handmade SphinxSE query mapping
Diffstat (limited to 'juick-server-jdbc/src/main/java/com/juick/service/SphinxSearchService.java')
-rw-r--r--juick-server-jdbc/src/main/java/com/juick/service/SphinxSearchService.java11
1 files changed, 6 insertions, 5 deletions
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