The Codex Document Management System is a RESTful API built with Java and Spring Boot. It allows users to create, update, search, and manage documents in a PostgreSQL database, while also indexing and searching through them using Elasticsearch.
- Save Documents: Create and store documents with titles and content.
- Update Documents: Patch existing documents to modify their titles and content.
- Search Documents: Perform full-text search across documents, prioritizing titles over content.
- Integration with Elasticsearch: Search functionality leverages Elasticsearch for efficient querying.
- Java 17
- Spring Boot
- PostgreSQL
- Elasticsearch
- Gradle
- Java 17
- PostgreSQL
- Elasticsearch
-
Clone the repository:
cd your-repo git clone https://github.com/raffeekk/backend-codex-task.git
-
Configure your PostgreSQL database:
- Create a database (e.g.,
codex_db
). - Update the database connection settings in
src/main/resources/application.properties
.
- Create a database (e.g.,
-
Run Elasticsearch locally.
-
Build the project:
./gradlew build
-
Start the application:
./gradlew bootRun
- Endpoint:
POST /document
- Request Body:
{ "title": "Document Title", "content": "Document content goes here." }
- Response:
{ "id": 1, "title": "Document Title", "content": "Document content goes here." }
- Endpoint:
PATCH /document
- Request Body:
{ "documentId": 1, "document": { "title": "Updated Title", "content": "Updated content goes here." } }
- Response:
{ "id": 1, "title": "Updated Title", "content": "Updated content goes here." }
- Endpoint:
POST /document/search
- Request Body:
{ "querystring": "search term" }
- Response:
[ { "id": 1, "title": "Document Title", "content": "Document content goes here." } ]
To run tests, use:
./gradlew test