Rediscogs
RediSearch demo based on data from discogs.com.
Setup
This demo requires Java 8, Redisearch and npm
If you would like to see album covers you will also need to register at Discogs.com and generate an API token
Running the demo
RediSearch
To run a RediSearch instance using docker:
docker run -p 6379:6379 redislabs/redisearch:latest
Server
Clone this git repository:
git clone https://github.com/Redislabs-Solution-Architects/rediscogs.git
cd rediscogs
Build the project:
mvn clean install
Running locally
Run the application:
java -jar server/target/rediscogs-server-0.0.1-SNAPSHOT.jar --discogs-api-token=<your_discogs_token> --spring.redis.host=<host> --spring.redis.port=<port>
Running in Docker
Build the Docker image:
cd server
mvn dockerfile:build
Run the container:
docker run -e "spring.redis.host=docker.for.mac.localhost" -e "discogs-api-token=<your_discogs_token>" -p 8080:8080 redislabs/rediscogs
Deploying to Cloud Foundry
- Create a Redis service instance named
rediscogs_redis
with Apps Manager orcf create-service
- Push the application
cf push
Demo Steps
Redis CLI
- Show number of keys in Redis:
info
- Run simple keyword search:
FT.SEARCH mastersIdx spring
- Show Hash for one of the previous matches:
HGETALL "master:834798"
- Highlight the
_class
field that Spring Data Redis uses to keep track of the original class (for object deserialization purposes) - Run prefix search:
FT.SEARCH mastersIdx spring*
- Show Hash for one of the previous matches:
HGETALL "master:151353"
Web UI
- Open http://localhost:8080
- Enter some characters in the Artist field to retrieve suggestions from RediSearch (e.g.
Dusty
) - Select an artist from the autocompleted options and click on the
Submit
button - Notice how long it takes to load images from the Discogs API
- After all images have been loaded, click on the
Submit
button again - Notice how fast the images are loading this time around
- In
redis-cli
show cached images:KEYS "images::*"
- Show type of a cached image:
TYPE "images::319832"
- Display image bytes stored in String data structure:
GET "images::319832"
- Go back to Web UI and select a different artist (e.g.
Bruce Springsteen
) - Hit the
Submit
button - Refine the search by adding a numeric filter on release year in
Query
field:@year:[1980 1990]
- Refine the search further by adding a filter on release genre:
@year:[1980 1990] @genres:pop