| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| import { invoke } from '@tauri-apps/api/core'; |
| import { MdxGroupIndex, SearchResultEntry, MdxIndex } from '../types'; |
| import { useSystemStore } from '../store/useSystemStore'; |
|
|
| |
| |
| |
| |
| export const searchIncremental = async ( |
| query: string |
| ): Promise<{ start_entry_no: number; total_count: number }> => { |
| return await invoke('search_search_incremental', { query }); |
| }; |
|
|
| |
| |
| |
| export const fulltextSearch = async ( |
| query: string |
| ): Promise<{ start_entry_no: number; total_count: number }> => { |
| return await invoke('search_fulltext_search', { query }); |
| }; |
|
|
| |
| |
| |
| export const getContentUrl = async (indexNo: number): Promise<string> => { |
| return await invoke('search_get_content_url', { indexNo }); |
| }; |
|
|
| |
| |
| |
| export const getEntryCount = async (): Promise<number> => { |
| return await invoke('search_get_entry_count'); |
| }; |
|
|
| |
| |
| |
| export const findIndex = async ( |
| key: string |
| ): Promise<{ group_index: MdxGroupIndex; total_count: number }> => { |
| return await invoke('search_find_index', { key }); |
| }; |
|
|
| |
| |
| |
| export const getResultKeyList = async ( |
| startIndexNo: number, |
| maxCount: number |
| ): Promise<SearchResultEntry[]> => { |
| const results = await invoke<[string, number][]>('search_get_result_key_list', { |
| startIndexNo, |
| maxCount, |
| }); |
| |
| return results.map(([keyword, entry_count]) => ({ |
| keyword, |
| entry_count, |
| })); |
| }; |
|
|
| |
| |
| |
| export const getGroupIndexes = async (indexNo: number): Promise<MdxGroupIndex[]> => { |
| return await invoke('search_get_group_indexes', { indexNo }); |
| }; |
|
|
| |
| |
| |
| export const getUrlForIndex = async (mdxIndex: MdxIndex): Promise<string> => { |
| const url= `${useSystemStore.getState().baseUrl}entryx?profile_id=${mdxIndex.profile_id}&entry_no=${mdxIndex.entry_no}`; |
| console.log('Generated URL:', url); |
| return url; |
| }; |
|
|
|
|
|
|