Created
October 26, 2021 18:06
-
-
Save sumanentc/a2b494d103b85a34a7ef7d51c37b1cb1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public List<Player> scanQuerySearch(String text) { | |
log.info("ScanQuery search to find players with the given field name and text"); | |
IgniteCache<Long, Player> playerCache = Ignition.ignite().getOrCreateCache(PLAYER); | |
ScanQuery<Long, Player> scanQuery = new ScanQuery<>((k, v) -> v.getTeam().equalsIgnoreCase(text)); | |
List<Player> players = new ArrayList<>(); | |
log.info("Query :: " + scanQuery); | |
try (QueryCursor<Cache.Entry<Long, Player>> cursor = playerCache.query(scanQuery)) { | |
Iterator<Cache.Entry<Long, Player>> iterator = cursor.iterator(); | |
while (iterator.hasNext()) { | |
Cache.Entry<Long, Player> entry = iterator.next(); | |
players.add(entry.getValue()); | |
} | |
} | |
return players; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment