This is a small project that I am using to learn Spring Boot. This REST API allows you to query a set of documents to find relevant documents. All search terms must be present in each returned document.
- Java 8+
- Gradle 6.8+
- Postgres database
If you have a document body to import, format it as JSON with the title
and text
properties, stored in corpus.json
in the project root.
To run the project, use the gradle bootRun task.
gradle bootRun
Get a list of document ids and titles that match all the words in the query
Parameter | Required | Type | Description |
---|---|---|---|
query |
required | string | The query to search the document database for |
[
{
"id": 21576018,
"title": "List of Friday the 13th characters"
},
{
"id": 21576903,
"title": "Matt Bomer"
}
]
Get a document with the ID specified in the path
{
"id": 19331052,
"title": "document title here",
"text": "document text here"
}
Submit a document to the database. It will return the saved document.
Parameter | Required | Type | Description |
---|---|---|---|
title |
required | string | The title of the document |
text |
required | string | The text of the document |
{
"id": 19331052,
"title": "document title here",
"text": "document text here"
}