I’m working on a proposal to rip out the existing PostgreSQL ILIKE/fuzzy_search based search in Lemmy (the federated Reddit clone) and replace it with Tantivy, a Rust full-text search library. The current implementation is basically WHERE title ILIKE '%query%' which obviously doesn’t scale and has zero relevance ranking. The proposal adds BM25 scoring, phrase queries, boolean operators, field-specific searches (author:name), tag filtering, and date ranges - all while keeping the existing API endpoint unchanged. I’d need to maintain a separate Tantivy index on disk, hook into all CRUD operations to keep it in sync, and build a query parser that translates user input into Tantivy’s query language. The alternative is just sticking with PostgreSQL’s built-in full-text search (tsvector/tsquery) which would be way less work to implement but wouldn’t give us the same level of advanced querying. Is rolling our own search index with Tantivy worth the complexity, or should we just use what Postgres already provides and call it a day?

  • Kache@lemmy.zip
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    23 hours ago

    way less work

    Okay so do postgres tsvector then

    Still an improvement

    You probably still have other things you want to do, too

    Also, the more advanced the feature is, reality is that the fewer users can make use of its full capability

    But forget all that, if you feel like doing it anyway, then do it, this is FOSS