Interface: ISearchService
Defined in: Services/ISearchService.ts:13
Search Service Interface
Defines the contract for search services. This interface allows for swapping search implementations (e.g., SQLite FTS5, Lunr.js, Elasticsearch) without changing the rest of the application.
Following the spec recommendation (line 3107) to create an interface for search so implementations can be swapped seamlessly.
Methods
buildIndex()
buildIndex(
module,books?,onProgress?):Promise<void>
Defined in: Services/ISearchService.ts:85
Build search index for a module Creates book-level FTS5 index for proximity searches
Parameters
module
string
Module abbreviation
books?
number[]
Optional array of book numbers to index (if not provided, indexes all books)
onProgress?
(progress) => void
Optional callback for progress updates
Returns
Promise<void>
Promise resolving when indexing is complete
clearHistory()
clearHistory():
Promise<void>
Defined in: Services/ISearchService.ts:60
Clear search history
Returns
Promise<void>
getHistory()
getHistory(
limit?):Promise<object[]>
Defined in: Services/ISearchService.ts:50
Get search history Returns recent searches for quick re-use
Parameters
limit?
number
Maximum number of history items (default 20)
Returns
Promise<object[]>
Array of recent search queries with metadata
getIndexStatus()
getIndexStatus(
modules):Promise<Map<string, {booksIndexed?:number;indexed:boolean;lastIndexed?:string;totalBooks?:number; }>>
Defined in: Services/ISearchService.ts:69
Check if modules are indexed for proximity search Returns status of book-level indexes for specified modules
Parameters
modules
string[]
Array of module abbreviations to check
Returns
Promise<Map<string, { booksIndexed?: number; indexed: boolean; lastIndexed?: string; totalBooks?: number; }>>
Map of module -> index status
getSuggestions()
getSuggestions(
partialQuery,limit?):Promise<string[]>
Defined in: Services/ISearchService.ts:41
Get autocomplete suggestions for partial query Used for search box autocomplete dropdown
Parameters
partialQuery
string
Partial query string
limit?
number
Maximum number of suggestions (default 10)
Returns
Promise<string[]>
Array of suggested query completions
parseQuery()
parseQuery(
query):ParsedQuery
Defined in: Services/ISearchService.ts:31
Parse a search query to determine type and extract components Handles complex syntax: "phrase" word1 word2 ~50w NOT (word3 AND word4)
Parameters
query
string
Raw search query string
Returns
ParsedQuery
Parsed query structure
search()
search(
query,options):Promise<SearchResult[]>
Defined in: Services/ISearchService.ts:22
Main search method Automatically detects query type and routes to appropriate search implementation
Parameters
query
string
Search query string (can include syntax like quotes, ~N, AND/OR/NOT, etc.)
options
Search options (scope, modules, filters, etc.)
Returns
Promise<SearchResult[]>
Promise resolving to array of search results