A demonstration e-commerce application showcasing advanced vector search capabilities using Weaviate Java Client v6, Spring Boot 3.x, and vanilla JavaScript.
-
3 Search Types:
- Keyword Search (BM25): Traditional keyword-based search
- Similarity Search (Vector): Semantic search using text embeddings
- Hybrid Search: Combines BM25 and vector search for best results
-
20 Product Catalog: Pre-loaded with diverse items across clothes, shoes, and accessories
-
Modern UI: Clean, responsive interface with tabbed search modes
-
Real-time Results: Instant search results with product cards
-
Weaviate Client v6: Built with the latest Weaviate Java Client v6 API
- Java 21 and Maven+
- Weaviate Cloud free Sandbox cluster
- Optional for running Weaviate locally: Docker Compose
Docker Compose
The project includes a docker-compose.yml file configured with Weaviate 1.34.0 and text2vec-transformers.
Start Weaviate:
docker-compose up -dThis will start:
- Weaviate on port 8080 (HTTP) and 50051 (gRPC)
- text2vec-transformers inference service for text vectorization
Wait about 30-60 seconds for all services to initialize.
Verify Weaviate is running:
curl http://localhost:8080/v1/.well-known/readyYou should see: {"status":"healthy"}
- Clone or navigate to the project directory:
cd vector-shop- Build the project:
mvn clean install- Run the application:
mvn spring-boot:runThe application will:
- Start on port 8081
- Connect to Weaviate on localhost:8080
- Automatically create the schema
- Import 20 products from
products.json
- Access the application:
Open your browser and navigate to:
http://localhost:8081
vector-shop/
├── src/
│ └── main/
│ ├── java/com/example/vectorshop/
│ │ ├── VectorShopApplication.java
│ │ ├── config/
│ │ │ └── WeaviateConfig.java
│ │ ├── controller/
│ │ │ ├── SearchController.java
│ │ │ └── SetupController.java
│ │ ├── model/
│ │ │ ├── ConnectionRequest.java
│ │ │ ├── GenerativeSearchResponse.java
│ │ │ ├── Product.java
│ │ │ └── SetupResponse.java
│ │ └── service/
│ │ ├── SearchService.java
│ │ └── SetupService.java
│ └── resources/
│ ├── application.properties
│ ├── products.json
│ └── static/
│ ├── index.html
│ ├── script.js
│ ├── styles.css
│ └── code/ (code snippet examples)
├── docker-compose.yml
├── pom.xml
├── LICENSE.md
└── README.md
GET /api/search/keyword?query={query}- Keyword searchGET /api/search/similarity?query={query}- Similarity searchGET /api/search/hybrid?query={query}- Hybrid searchGET /api/search/image?imageUrl={url}- Image searchGET /api/search/generative?query={query}- Generative search
Edit src/main/resources/application.properties:
# Server Configuration
server.port=8081
# Weaviate Configuration
weaviate.host=localhost
weaviate.port=8080
weaviate.scheme=http- Backend: Java 21, Spring Boot 3.2.1, Maven
- Vector Database: Weaviate 1.34.0
- Vectorizers: text2vec-weaviate (for Weaviate Cloud) & text2vec-transformers (for local instance)
- Frontend: HTML5, CSS3, JavaScript
- Libraries:
- Weaviate Java Client v6 (6.0.0-M2)
- Jackson (JSON processing)
- Lombok (code generation)
- Keyword: "blue jeans", "running shoes", "winter"
- Similarity: "comfortable casual wear", "athletic footwear"
- Hybrid: "stylish accessories for summer"
Port 8080 already in use
```bash # Find and stop the process lsof -ti:8080 | xargs kill -9 ```Port 8081 already in use
Edit src/main/resources/application.properties and change:
server.port=8082Data not loading
Check the application logs for errors. The seeder runs automatically on startup.
Weaviate not responding
```bash # Restart Weaviate docker-compose restart weaviate ```Connection Refused Error
- Ensure Weaviate is running on port 8080
- Check Docker containers:
docker ps
No Search Results
- Check Weaviate logs:
docker logs weaviate - Verify data was seeded in application logs
Generative Search Not Working
- This feature requires OpenAI API key
- Error messages will indicate if the API key is missing or invalid
Image Search Not Working
- Image search in v6 requires base64-encoded images
- URL-based image search is not directly supported in the current implementation
MIT License - Free to use and modify.
