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 NextSearchesHooks

From Leeroopedia
Knowledge Sources
Domains Frontend, Search
Last Updated 2026-02-12 06:00 GMT

Overview

Concrete hooks for search applications list management provided by the RAGFlow frontend.

Description

The next-searches/hooks module exports hooks and types for managing the search applications CRUD lifecycle: `useCreateSearch` (creates a new search app), `useFetchSearchList` (paginated, debounced search list query), `useFetchSearchDetail` (fetches a single search app config with shared-search support), `useDeleteSearch` (deletes a search app with cache invalidation), `useUpdateSearch` (updates search settings), and `useRenameSearch` (orchestrates create-or-rename with modal state management and navigation). It also exports key interfaces: `ISearchAppProps`, `ISearchAppDetailProps` (including full `search_config`), and `IUpdateSearchProps`.

Usage

Import `useFetchSearchList` and `useRenameSearch` in the search applications list page. Import `useFetchSearchDetail` and `useUpdateSearch` in the search settings page. Import `ISearchAppDetailProps` as a shared type across search components.

Code Reference

Source Location

Signature

export const useCreateSearch = () => { data; isError; createSearch };
export const useFetchSearchList = () => {
  data; isLoading; isError; pagination; searchString; handleInputChange; setPagination; refetch;
};
export interface ISearchAppProps { avatar; create_time; created_by; description; id; name; nickname; status; tenant_id; update_time }
export interface ISearchAppDetailProps { avatar; created_by; description; id; name; search_config: { ... }; tenant_id; update_time }
export const useFetchSearchDetail = (tenantId?: string) => { data: ISearchAppDetailProps; isLoading; isError };
export const useDeleteSearch = () => { data; isError; deleteSearch };
export type IUpdateSearchProps = Omit<ISearchAppDetailProps, 'id'> & { search_id: string };
export const useUpdateSearch = () => { data; isError; updateSearch };
export const useRenameSearch = () => {
  searchRenameLoading; initialSearchName; onSearchRenameOk; openCreateModal;
  hideSearchRenameModal; showSearchRenameModal;
};

Import

import {
  useFetchSearchList,
  useFetchSearchDetail,
  useRenameSearch,
  useDeleteSearch,
  ISearchAppDetailProps,
} from '@/pages/next-searches/hooks';

I/O Contract

Inputs

Name Type Required Description
tenantId string No Tenant ID for shared search detail fetching (passed to useFetchSearchDetail)

Outputs

Name Type Description
data SearchListResponse Search list response containing search_apps array and total count
isLoading boolean Whether the search list query is in progress
pagination { current: number; pageSize: number } Current pagination state with router sync
handleInputChange ChangeEventHandler Debounced search input change handler
deleteSearch (props: { search_id: string }) => Promise Deletes a search app and invalidates the list cache
updateSearch (formData: IUpdateSearchProps) => Promise Updates search settings and invalidates the detail cache

Usage Examples

import { useFetchSearchList, useRenameSearch } from '@/pages/next-searches/hooks';

function SearchListPage() {
  const { data, isLoading, pagination, handleInputChange, setPagination } = useFetchSearchList();
  const { showSearchRenameModal, onSearchRenameOk, openCreateModal } = useRenameSearch();

  return (
    <>
      <Input onChange={handleInputChange} />
      {data?.data.search_apps.map(app => <SearchCard key={app.id} {...app} />)}
    </>
  );
}

Related Pages

Page Connections

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