Skip to content

stereobooster/facets

Repository files navigation

Facets monorepo

It is the monorepo repository:

Facets is a client-side (though you can run it on the server) faceted search engine.

Facet - any of the definable aspects that make up a subject (as of contemplation) or an object (as of consideration)

Facets main purpose is to do the faceting aspect of the search. Text search is outsourced to other libraries, for example, you can use:

The main secret ingredient is TypedFastBitSet.js - a fast set data structure. Using it and standard Map allows us to build an inverted-index data structure. From there, it's a pretty straightforward implementation.

Demo

Netlify Status

It is easier to show than explain. See online demo here.

Is it ready for production?

The demo works, as you can see, but beyond that, there was no exhaustive testing. There are still rough edges. API can change.

Backstory

The library inspired by ItemsJS. There are only three solutions that do faceted searches on the client-side:

  • Tanstack table. It is not a primary purpose of the library, though it's possible
  • Orama. It is quite slow in my testing
  • ItemsJS

Read my article for details.

Initially, I wanted to fork ItemsJS, but I thought - it would be easier to write a library from scratch.

Warning

Appearantly pagefind also supports faceted search and loading data from json. I found out it only after implemented this library.

See:

Development

pnpm i
pnpm run dev

Logo

Logo by Pravin Unagar from Noun Project (CC BY 3.0)

TODO

  • prettier, eslint