Giter VIP home page Giter VIP logo

rediscogs's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.