A fast and modular laptop recommendation system using KD-Tree + local hash + Ollama embedding.
⚠️ This is an example implementation of VectorMap-Index. It is provided for educational and demonstration purposes only.
- 100 laptops with unique, rich descriptions
- KD-Tree + local hash for ultra-fast nearest neighbor search
- Embedding powered by local Ollama LLM
- Clean, modular, and extendable codebase
- Ready for: top-N search, distance score output, REST API
Run:
node generate-product.js
✅ Generates data.json
with laptop names, unique descriptions, and embedding vectors.
Run:
node index.js
✅ Runs batch search queries and prints matched product names and descriptions.
Example query list inside index.js
:
[
'powerful fast laptop',
'high resolution laptop',
'durable grade laptop',
'long battery laptop',
'dedicated gpu laptop'
]
Make sure Ollama is running:
ollama serve
Ensure the embedding model is pulled:
ollama pull nomic-embed-text
Query: powerful fast laptop
Matched: Laptop Model 42 - Laptop Model 42 fast boot time with NVMe SSD
---
Query: high resolution laptop
Matched: Laptop Model 50 - Laptop Model 50 high refresh rate display for gamers
---
Query: durable grade laptop
Matched: Laptop Model 52 - Laptop Model 52 durable keys rated for 20 million presses
---
Query: long battery laptop
Matched: Laptop Model 21 - Laptop Model 21 AI-enhanced battery management system
---
Query: dedicated gpu laptop
Matched: Laptop Model 44 - Laptop Model 44 VR ready specs for immersive gaming
---
.
├── .gitignore # Git ignore rules
├── data.json # Generated laptop data with embedding vectors
├── generate-product.js # Generates 100 laptops with unique descriptions and vectors
├── helpers/
│ ├── Ollama.js # Embedding helper using Ollama
│ └── VectorMap.js # KD-Tree + local hash VectorMapIndex class
├── index.js # Batch search runner
├── package.json # Node.js project config
MIT License © 2025 NeaByteLab