A powerful content indexing and search platform built with Spring Boot and Apache Lucene, now featuring a modern React frontend.
- Content Management: Create, read, update, and delete content items
- Full-Text Search: Advanced search capabilities powered by Apache Lucene
- REST API: Complete REST API for programmatic access
- Modern Web Interface: React-based frontend with shadcn/ui components
- Search Highlighting: Results include highlighted search terms
- Filter Search: Search by category, author, and text content
- Real-time Indexing: Content is automatically indexed when created or updated
- Responsive Design: Works seamlessly on desktop, tablet, and mobile devices
- Spring Boot: 3.2.0
- Search Engine: Apache Lucene 9.8.0
- Database: H2 Database (embedded)
- ORM: Spring Data JPA
- Build Tool: Maven
- React: 19 with TypeScript
- Build Tool: Vite
- UI Components: shadcn/ui
- Styling: Tailwind CSS
- HTTP Client: Axios
- Routing: React Router
- Java 17 or later
- Maven 3.6 or later
- Node.js 18 or later (for frontend development)
- Clone the repository:
git clone https://github.com/openviglet/viglet-search.git
cd viglet-search
- Build and run the application:
mvn spring-boot:run
- Open your browser and navigate to:
http://localhost:8080
The application will create an H2 database file and Lucene index directory automatically.
The React frontend is located in the frontend/
directory and is automatically built during the Maven build process.
For frontend development with hot reload:
- Start the Spring Boot backend:
mvn spring-boot:run
- In a separate terminal, start the frontend development server:
cd frontend
npm install
npm run dev
- Open your browser to:
http://localhost:3000
The development server will proxy API requests to the Spring Boot backend at http://localhost:8080
.
To manually build the frontend:
cd frontend
npm install
npm run build
The built files will be placed in src/main/resources/static/
and served by Spring Boot.
GET /api/content
- List all contentGET /api/content/{id}
- Get content by IDPOST /api/content
- Create new contentPUT /api/content/{id}
- Update contentDELETE /api/content/{id}
- Delete content
GET /api/content/search?query={text}&category={category}&author={author}&maxResults={number}
- Search content
POST /api/content/reindex
- Reindex all content
curl -X POST http://localhost:8080/api/content \
-H "Content-Type: application/json" \
-d '{
"title": "Spring Boot Tutorial",
"body": "This is a comprehensive tutorial about Spring Boot framework.",
"category": "Technology",
"author": "John Doe",
"tags": "spring boot, java, tutorial"
}'
curl "http://localhost:8080/api/content/search?query=java"
curl "http://localhost:8080/api/content/search?query=spring&category=Technology&author=John%20Doe"
The modern React frontend provides:
- Homepage: Welcome page with statistics and recent content
- Content Management: Full CRUD operations with intuitive forms
- Content List: Paginated view of all content with search and filters
- Content Detail: Rich view of individual content items with metadata
- Advanced Search: Comprehensive search with multiple filters
- Search Results: Highlighted results with relevance scores
- Responsive Design: Optimized for desktop, tablet, and mobile
- Modern UI: Clean interface built with shadcn/ui components
java spring
- Find documents containing both words"spring boot"
- Find exact phrasejava OR python
- Find documents containing either wordjava -python
- Find documents with java but not python
- Category: Filter by content category
- Author: Filter by content author
- Combined: Use text query with filters for precise results
Key configuration options in application.properties
:
# Server Configuration
server.port=8080
# Database Configuration
spring.datasource.url=jdbc:h2:./data/viglet-search
# Lucene Index Configuration
viglet.search.index.path=./lucene-index
# JPA Configuration
spring.jpa.hibernate.ddl-auto=update
You can customize the Lucene index location by setting:
viglet.search.index.path=/path/to/your/index
src/
├── main/
│ ├── java/com/viglet/search/
│ │ ├── config/ # Configuration classes
│ │ ├── controller/ # REST controllers
│ │ ├── dto/ # Data Transfer Objects
│ │ ├── entity/ # JPA entities
│ │ ├── repository/ # JPA repositories
│ │ └── service/ # Business logic
│ └── resources/
│ ├── static/ # Built React frontend
│ └── application.properties
├── test/
│ └── java/ # Test files
└── frontend/ # React frontend source
├── src/
│ ├── components/ # React components
│ │ └── ui/ # shadcn/ui components
│ ├── pages/ # Page components
│ ├── lib/ # Utilities and API client
│ ├── types/ # TypeScript definitions
│ └── hooks/ # Custom React hooks
├── package.json
├── vite.config.ts
└── tailwind.config.js
mvn clean compile
mvn test
mvn clean package
The application JAR will be created in the target/
directory.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
For issues and questions, please use the GitHub issue tracker.