https://github.com/stereobooster/facets
Client-side faceted search engine
https://github.com/stereobooster/facets
client-side faceted faceted-search facets full-text full-text-search instantsearch search
Last synced: about 2 months ago
JSON representation
Client-side faceted search engine
- Host: GitHub
- URL: https://github.com/stereobooster/facets
- Owner: stereobooster
- Created: 2023-11-07T15:11:38.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-17T22:50:20.000Z (9 months ago)
- Last Synced: 2025-03-27T11:43:35.847Z (2 months ago)
- Topics: client-side, faceted, faceted-search, facets, full-text, full-text-search, instantsearch, search
- Language: TypeScript
- Homepage: https://facets-demo.stereobooster.com/
- Size: 2.01 MB
- Stars: 27
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Facets monorepo
![]()
It is the monorepo repository:
- main package - [facets](/packages/facets/) 
- [InstantSearch adapter for facets](/packages/facets-instantsearch/) 
- and [demo site](/packages/demo/README.md)**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:
- [QuickScore](https://github.com/fwextensions/quick-score)
- [MiniSearch](https://github.com/lucaong/minisearch)
- [Fuse.js](https://github.com/krisk/fuse)
- [flexsearch](https://github.com/nextapps-de/flexsearch)
- and you can write an adapter for any other text search engineThe main secret ingredient is [TypedFastBitSet.js](https://github.com/lemire/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
[](https://app.netlify.com/sites/facets-demo/deploys)
It is easier to show than explain. [See online demo here](https://facets-demo.stereobooster.com/).
## 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](https://github.com/itemsapi/itemsjs). There are only three solutions that do faceted searches on the client-side:
- [Tanstack table](https://tanstack.com/table/). It is not a primary purpose of the library, though it's possible
- [Orama](https://docs.oramasearch.com/open-source/usage/search/facets). It is quite slow in my testing
- ItemsJSRead [my article](https://stereobooster.com/posts/faceted-search/) 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](https://pagefind.app/docs/js-api-filtering/) and [loading data from json](https://pagefind.app/docs/node-api/). I found out it only after implemented this library.See:
- [pagefind-instantsearch](https://github.com/stereobooster/pagefind-instantsearch)
- https://github.com/CloudCannon/pagefind/discussions/512## Development
```sh
pnpm i
pnpm run dev
```## Logo
Logo by Pravin Unagar from Noun Project (CC BY 3.0)
## TODO
- prettier, eslint