How to use the searchkit.NestedFacetAccessor function in searchkit

To help you get started, we’ve selected a few searchkit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github searchkit / searchkit / packages / searchkit-autosuggest / src / datasources / HierarchicalRefinementDatasource.ts View on Github external
configure(searchkit) {
        this.searchkit = searchkit
        if (this.options.accessorId) {
            let accessor = searchkit.accessors.statefulAccessors[this.options.accessorId]
            if (!accessor) {
                console.error(`Could not create facet filter datasource with accessorId=${this.options.accessorId}`)
            } else {
                this.originalAccessor = accessor
            }
        } else {
            let { id, field, startLevel, title } = this.options
            this.originalAccessor = new NestedFacetAccessor(id, {
                id, field, startLevel, title
            })
            this.searchkit.addAccessor(this.originalAccessor)
        }
        this.delegateAccessor = this.createDelegate(this.originalAccessor)
    }
github searchkit / searchkit / packages / searchkit-autosuggest / src / datasources / HierarchicalRefinementDatasource.ts View on Github external
createDelegate(accessor) {
        let delegateAccessor = new NestedFacetAccessor(accessor.options.id, { ...accessor.options })
        delegateAccessor.uuid = accessor.options.id
        return delegateAccessor
    }