Setting and Query
Index Settings
staticseek provides several index types to optimize search performance:
-
LinearIndex: Standard implementation for small to medium datasets.
const index = createIndex(LinearIndex, array_of_articles); -
GPULinearIndex: WebGPU-accelerated implementation for faster fuzzy queries.
const index = createIndex(GPULinearIndex, array_of_articles); -
HybridTrieBigramInvertedIndex: High-performance implementation for larger datasets.
const index = createIndex(HybridTrieBigramInvertedIndex, array_of_articles);
Query Syntax
staticseek supports various query syntaxes:
-
Fuzzy Search:
- By default, staticseek performs fuzzy search with an edit distance of 1, meaning it tolerates one character error per search term. Simply inputting a string will trigger a fuzzy search.
-
Exact Match Search:
- Use quotes:
"exact phrase"
- Use quotes:
-
Boolean Operations:
- AND:
term1 term2
- OR:
term1 OR term2
- NOT:
-term1 term2
- AND:
-
Field-Specific Search:
from:title searchterm
Error Handling
Handle potential errors by checking for StaticSeekError
when executing queries. Ensure to implement appropriate error handling in your application.