Show HN: Java In-Memory search using Forage
2 points| tusharnaik | 1 month ago |livetheoogway.github.io
I built Forage because I kept running into the same problem: I had a few tens of thousands of records in my main database, that needed full-text search, but standing up Elasticsearch felt like overkill. The alternatives were either clunky database LIKE queries or maintaining a sync pipeline to a dedicated search cluster.
Forage is a Java library that builds a Lucene index directly in your application's memory. You pull data from your database, index it locally, and search with zero network hops.
What it does:
- Lucene power: fuzzy matching, phrase queries, boolean logic, range queries
- Function scoring for custom ranking (field boosting, decay functions, scripts)
- Cursor-based pagination
- Stays in sync with your database through periodic bootstrapping
- First-class Dropwizard integration
When it makes sense:
- Dataset fits in memory (up to ~1M documents)
- You want microsecond search latency, not milliseconds
- You don't want to operate search infrastructure when you have data in an existing relational / non-relational setup
When it doesn't:
- You need distributed search across nodes
- Dataset exceeds heap memory
- Real-time indexing of high-velocity streams
No comments yet.