Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Infiniflow Ragflow UseSelectFilters Hook

From Leeroopedia
Revision as of 11:23, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Infiniflow_Ragflow_UseSelectFilters_Hook.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Frontend, Knowledge_Base
Last Updated 2026-02-12 06:00 GMT

Overview

Filter building hook that aggregates document filter data into structured filter collections for the dataset toolbar.

Description

useSelectDatasetFilters fetches filter aggregation data via useGetDocumentFilter and transforms it into FilterCollection arrays. It builds three filter groups: File Type (from filter.suffix with uppercase labels and counts), Status (from filter.run_status with localized labels, plus an optional EMPTY_METADATA_FIELD entry from filter.metadata), and Metadata field (nested filters with per-value counts and searchability). The hook also defines a filterGroup mapping that groups type and run under systemAttribute. The EMPTY_METADATA_FIELD constant is exported for use by consumers.

Usage

Consumed by the dataset page to populate the filter popover toolbar with file type, status, and metadata field filters.

Code Reference

Source Location

Signature

export const EMPTY_METADATA_FIELD = 'empty_metadata';

export function useSelectDatasetFilters(): {
  filters: FilterCollection[];
  onOpenChange: function;
  filterGroup: Record<string, string[]>;
};

Import

import { useSelectDatasetFilters, EMPTY_METADATA_FIELD } from './use-select-filters';

I/O Contract

Inputs

Name Type Required Description
(none) - - Fetches filter data internally via useGetDocumentFilter

Outputs

Name Type Description
filters FilterCollection[] Structured filter groups for the toolbar popover
onOpenChange function Callback to refresh filter data on popover open
filterGroup Record Grouping of filter fields by category

Usage Examples

const { filters, onOpenChange, filterGroup } = useSelectDatasetFilters();

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment