@stereobooster/facets
v0.1.1
Published
Client-side (though you can run it on the server) faceted search engine
Downloads
77
Maintainers
Readme
Facets
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
- MiniSearch
- Fuse.js
- flexsearch
- and you can write an adapter for any other text search engine
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
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.
TODO
- default values for facet by type
- number
- sort by value asc
showZeroes=false
- number
- initialization
- memoization
maxValuesPerFacet
facets: "price"
- numeric filter
- support
>
(not just>=
),<
(not just<=
) - support multiple ranges e.g
[{ from, to }, { eq }, { neq }]
- support
- more tests
- errors and warnings, for example
- warn if people try to use text search without providing text index
- benchmarks
- performance seems to be good (except numeric range filter), but in order to be sure we need to do benchmark
- benchmark memory
- https://www.valentinog.com/blog/node-usage/
- I'm curious if using TrieMap would allow to save memory