Aslan11 / rediscogs

RediSearch demo based on data from discogs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  1. Create a Redis service instance named rediscogs_redis with Apps Manager or cf create-service
  2. Push the application
cf push

Demo Steps

Redis CLI

  1. Show number of keys in Redis: info
  2. Run simple keyword search: FT.SEARCH mastersIdx spring
  3. Show Hash for one of the previous matches: HGETALL "master:834798"
  4. Highlight the _class field that Spring Data Redis uses to keep track of the original class (for object deserialization purposes)
  5. Run prefix search: FT.SEARCH mastersIdx spring*
  6. Show Hash for one of the previous matches: HGETALL "master:151353"

Web UI

  1. Open http://localhost:8080
  2. Enter some characters in the Artist field to retrieve suggestions from RediSearch (e.g. Dusty)
  3. Select an artist from the autocompleted options and click on the Submit button
  4. Notice how long it takes to load images from the Discogs API
  5. After all images have been loaded, click on the Submit button again
  6. Notice how fast the images are loading this time around
  7. In redis-cli show cached images: KEYS "images::*"
  8. Show type of a cached image: TYPE "images::319832"
  9. Display image bytes stored in String data structure: GET "images::319832"
  10. Go back to Web UI and select a different artist (e.g. Bruce Springsteen)
  11. Hit the Submit button
  12. Refine the search by adding a numeric filter on release year in Query field: @year:[1980 1990]
  13. Refine the search further by adding a filter on release genre: @year:[1980 1990] @genres:pop

About

RediSearch demo based on data from discogs.com


Languages

Language:Java 64.7%Language:TypeScript 23.8%Language:HTML 4.5%Language:JavaScript 3.7%Language:CSS 2.9%Language:Dockerfile 0.4%