Skip to content

spring-data-search/spring-boot-starter-data-search-jpa-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started

This is a demo project for the library spring-boot-starter-data-search-jpa

Online Demo

This demo is deployed on heroku and sleeps after 30 minutes of inactivity. Your first request could be slow if it occurs when the application is sleeping. In this case, please retry a few seconds after your first request.

https://data-search-jpa-demo.herokuapp.com/customers

Requirements

Java version 11 or higher (If java 8 support is needed, please vote for this issue)

SpringBoot version 2.1.0 or higher

Usage

Clone, build and start as any other SpringBoot application.

spring-boot-starter-data-search-jpa-demo comes with an embedded h2 and the customers' table is initialized on startup with 10000 documents.

If you want to deactivate the data init, or you want more data for your tests, you can adapt the configuration file.

demo.data-init=true
demo.data-size=10000

Customer structure

{
    "id": "13e3afc8-0832-41c4-bb12-812e516d0980",
    "ref": 1966,
    "title": "Ms.",
    "name": "Angelique",
    "surname": "VonRueden",
    "email": "angelique.vonrueden@gmail.com",
    "emailVerified": true,
    "birthDate": "1989-04-14",
    "addresses": [
        {
            "id": "011992a8-dbf1-4398-9aef-5d4563df5c0c",
            "street": "942 Charlette Forges",
            "zipCode": "98527-5724",
            "city": "Stiedemannberg",
            "country": "CW"
        },
        {
            "id": "10a09a89-2359-457c-b50a-308dda9d7add",
            "street": "400 Schamberger Lodge",
            "zipCode": "22998",
            "city": "Andreshire",
            "country": "CN"
        }
    ],
    "coins": 44.801514,
    "createdDate": "2021-06-12T11:21:13.897Z"
}

Search API

By default, with data-search, all customer fields become searchable.

curl -L -X  GET 'http://localhost:8080/customers?search=birthDate >: 1988-01-01 and (email : *gmail.com or email: *protonmail.com)&page=0&size=10&sort=name,desc'