mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-16 10:48:46 +00:00
Merge pull request #70 from ClaytonWWilson/item-search-limit
Limit item search results
This commit is contained in:
commit
3b8e13e84c
@ -7,19 +7,18 @@ import java.util.Map;
|
||||
|
||||
public class ItemSearcher implements CallHandler {
|
||||
|
||||
DBConnector connector;
|
||||
Connection connection;
|
||||
String cognitoID;
|
||||
|
||||
private final String GET_ITEM_MATCHES = "SELECT * FROM Product WHERE description LIKE ?";
|
||||
private final String GET_ITEM_MATCHES = "SELECT * FROM Product WHERE description LIKE ? LIMIT 100;";
|
||||
|
||||
public ItemSearcher(DBConnector connector, String cognitoID) {
|
||||
this.connector = connector;
|
||||
public ItemSearcher(Connection connection, String cognitoID) {
|
||||
this.connection = connection;
|
||||
this.cognitoID = cognitoID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object conductAction(Map<String, Object> body, HashMap<String, String> queryParams, String s) throws SQLException {
|
||||
try (Connection connection = connector.getConnection()) {
|
||||
PreparedStatement getItemMatches = connection.prepareStatement(GET_ITEM_MATCHES);
|
||||
getItemMatches.setString(1, "%" + queryParams.get("id") + "%");
|
||||
System.out.println(getItemMatches);
|
||||
@ -28,5 +27,4 @@ public class ItemSearcher implements CallHandler {
|
||||
System.out.println(searchResultsObject);
|
||||
return searchResultsObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user