mirror of
https://github.com/zadam/trilium.git
synced 2025-10-19 22:58:52 +02:00
feat(docs): also update documentation for search updates
This commit is contained in:
parent
5b669ca287
commit
415bbc3b0a
@ -3,13 +3,50 @@
|
||||
|
||||
The _Quick search_ function does a full-text search (that is, it searches through the content of notes and not just the title of a note) and displays the result in an easy-to-access manner.
|
||||
|
||||
The alternative to the quick search is the <a class="reference-link" href="Search.md">Search</a> function, which opens in a dedicated tab and has support for advanced queries.
|
||||
The alternative to the quick search is the <a class="reference-link" href="Search.md">Search</a> function, which opens in a dedicated tab and has support for advanced queries.
|
||||
|
||||
For even faster navigation, it's possible to use <a class="reference-link" href="Jump%20to.md">Jump to Note</a> which will only search through the note titles instead of the content.
|
||||
For even faster navigation, it's possible to use <a class="reference-link" href="Jump%20to.md">Jump to Note</a> which will only search through the note titles instead of the content.
|
||||
|
||||
## Layout
|
||||
|
||||
Based on the <a class="reference-link" href="../UI%20Elements/Vertical%20and%20horizontal%20layout.md">Vertical and horizontal layout</a>, the quick search is placed:
|
||||
Based on the <a class="reference-link" href="../UI%20Elements/Vertical%20and%20horizontal%20layout.md">Vertical and horizontal layout</a>, the quick search is placed:
|
||||
|
||||
* On the vertical layout, it is displayed right above the <a class="reference-link" href="../UI%20Elements/Note%20Tree.md">Note Tree</a>.
|
||||
* On the horizontal layout, it is displayed in the <a class="reference-link" href="../UI%20Elements/Launch%20Bar.md">Launch Bar</a>, where it can be positioned just like any other icon.
|
||||
* On the vertical layout, it is displayed right above the <a class="reference-link" href="../UI%20Elements/Note%20Tree.md">Note Tree</a>.
|
||||
* On the horizontal layout, it is displayed in the <a class="reference-link" href="../UI%20Elements/Launch%20Bar.md">Launch Bar</a>, where it can be positioned just like any other icon.
|
||||
|
||||
## Search Features
|
||||
|
||||
Quick search includes the following features:
|
||||
|
||||
### Content Previews
|
||||
Search results now display a 200-character preview of the note content below the note title. This preview shows the context where your search terms appear, making it easier to identify the right note without opening it.
|
||||
|
||||
### Infinite Scrolling
|
||||
Results are loaded progressively as you scroll:
|
||||
- Initial display shows 15 results
|
||||
- Scrolling near the bottom automatically loads 10 more results
|
||||
- Continue scrolling to load all matching notes
|
||||
|
||||
### Visual Features
|
||||
- **Highlighting**: Search terms appear in bold with accent colors
|
||||
- **Separation**: Results are separated with dividers
|
||||
- **Theme Support**: Highlighting colors adapt to light/dark themes
|
||||
|
||||
### Search Behavior
|
||||
Quick search uses progressive search:
|
||||
1. Shows exact matches first
|
||||
2. Includes fuzzy matches when exact results are fewer than 5
|
||||
3. Exact matches appear before fuzzy matches
|
||||
|
||||
### Keyboard Navigation
|
||||
- Press `Enter` to open the first result
|
||||
- Use arrow keys to navigate through results
|
||||
- Press `Escape` to close the quick search
|
||||
|
||||
## Using Quick Search
|
||||
|
||||
1. **Typo tolerance**: Search finds results despite minor typos
|
||||
2. **Content previews**: 200-character snippets show match context
|
||||
3. **Infinite scrolling**: Additional results load on scroll
|
||||
4. **Specific terms**: Specific search terms return more focused results
|
||||
5. **Match locations**: Bold text indicates where matches occur
|
@ -66,11 +66,25 @@ The options available are:
|
||||
* `#book #publicationYear = 1954`: Find notes with the "book" label and "publicationYear" set to 1954.
|
||||
* `#genre *=* fan`: Find notes with the "genre" label containing the substring "fan". Additional operators include `*=*` for "contains", `=*` for "starts with", `*=` for "ends with", and `!=` for "is not equal to".
|
||||
* `#book #publicationYear >= 1950 #publicationYear < 1960`: Use numeric operators to find all books published in the 1950s.
|
||||
* `#dateNote >= TODAY-30`: A "smart search" to find notes with the "dateNote" label within the last 30 days. Supported smart values include NOW +- seconds, TODAY +- days, MONTH +- months, YEAR +- years.
|
||||
* `#dateNote >= TODAY-30`: Find notes with the "dateNote" label within the last 30 days. Supported date values include NOW +- seconds, TODAY +- days, MONTH +- months, YEAR +- years.
|
||||
* `~author.title *=* Tolkien`: Find notes related to an author whose title contains "Tolkien".
|
||||
* `#publicationYear %= '19[0-9]{2}'`: Use the '%=' operator to match a regular expression (regex). This feature has been available since Trilium 0.52.
|
||||
* `note.content %= '\\d{2}:\\d{2} (PM|AM)'`: Find notes that mention a time. Backslashes in a regex must be escaped.
|
||||
|
||||
### Fuzzy Search
|
||||
|
||||
Trilium supports fuzzy search operators that find results with typos or spelling variations:
|
||||
|
||||
* `#title ~= trilim`: Fuzzy exact match - finds notes with titles like "Trilium" even if you typed "trilim" (with typo)
|
||||
* `#content ~* progra`: Fuzzy contains match - finds notes containing words like "program", "programmer", "programming" even with slight misspellings
|
||||
* `note.content ~* develpment`: Will find notes containing "development" despite the typo
|
||||
|
||||
**Important notes about fuzzy search:**
|
||||
- Fuzzy search requires at least 3 characters in the search term
|
||||
- Maximum edit distance is 2 characters (number of character changes needed)
|
||||
- Diacritics are normalized (e.g., "café" matches "cafe")
|
||||
- Fuzzy matches work best for finding content with minor typos or spelling variations
|
||||
|
||||
### Advanced Use Cases
|
||||
|
||||
* `~author.relations.son.title = 'Christopher Tolkien'`: Search for notes with an "author" relation to a note that has a "son" relation to "Christopher Tolkien". This can be modeled with the following note structure:
|
||||
@ -117,6 +131,32 @@ Some queries can only be expressed with negation:
|
||||
|
||||
This query finds all book notes not in the "Tolkien" subtree.
|
||||
|
||||
## Progressive Search Strategy
|
||||
|
||||
Trilium uses a progressive search strategy that performs exact matching first, then adds fuzzy matching when needed.
|
||||
|
||||
### How Progressive Search Works
|
||||
|
||||
1. **Phase 1 - Exact Matching**: When you search, Trilium first looks for exact matches of your search terms. This handles the vast majority of searches (90%+) and returns results almost instantly.
|
||||
|
||||
2. **Phase 2 - Fuzzy Fallback**: If Phase 1 doesn't find enough high-quality results (fewer than 5 results with good relevance scores), Trilium automatically adds fuzzy matching to find results with typos or spelling variations.
|
||||
|
||||
3. **Result Ordering**: Exact matches always appear before fuzzy matches, regardless of individual scores. This ensures that when you search for "project", notes containing the exact word "project" will appear before notes containing similar words like "projects" or "projection".
|
||||
|
||||
### Progressive Search Behavior
|
||||
|
||||
- **Speed**: Most searches complete using only exact matching
|
||||
- **Ordering**: Exact matches appear before fuzzy matches
|
||||
- **Fallback**: Fuzzy matching activates when exact matches return fewer than 5 results
|
||||
- **Identification**: Results indicate whether they are exact or fuzzy matches
|
||||
|
||||
### Search Performance
|
||||
|
||||
Search system specifications:
|
||||
- Content size limit: 10MB per note (previously 50KB)
|
||||
- Edit distance calculations for fuzzy matching
|
||||
- Infinite scrolling in Quick Search
|
||||
|
||||
## Under the Hood
|
||||
|
||||
### Label and Relation Shortcuts
|
||||
@ -142,7 +182,7 @@ However, common label and relation searches have shortcut syntax:
|
||||
|
||||
### Separating Full-Text and Attribute Parts
|
||||
|
||||
Search syntax allows combining full-text search with attribute-based search seamlessly. For example, `tolkien #book` contains:
|
||||
Search syntax allows combining full-text search with attribute-based search. For example, `tolkien #book` contains:
|
||||
|
||||
1. Full-text tokens - `tolkien`
|
||||
2. Attribute expressions - `#book`
|
||||
@ -181,4 +221,21 @@ This finds notes created in May 2019. Numeric operators like `#publicationYear >
|
||||
|
||||
You can open Trilium and automatically trigger a search by including the search [url encoded](https://meyerweb.com/eric/tools/dencoder/) string in the URL:
|
||||
|
||||
`http://localhost:8080/#?searchString=abc`
|
||||
`http://localhost:8080/#?searchString=abc`
|
||||
|
||||
## Search Configuration
|
||||
|
||||
### Parameters
|
||||
|
||||
| Parameter | Value | Description |
|
||||
|-----------|-------|-------------|
|
||||
| MIN_FUZZY_TOKEN_LENGTH | 3 | Minimum characters for fuzzy matching |
|
||||
| MAX_EDIT_DISTANCE | 2 | Maximum character changes allowed |
|
||||
| RESULT_SUFFICIENCY_THRESHOLD | 5 | Minimum exact results before fuzzy fallback |
|
||||
| MAX_CONTENT_SIZE | 10MB | Maximum note content size for search processing |
|
||||
|
||||
### Limits
|
||||
|
||||
* Searched note content is limited to 10MB per note to prevent performance issues
|
||||
* Notes exceeding this limit will still be included in title and attribute searches
|
||||
* Fuzzy matching requires tokens of at least 3 characters
|
25
docs/User Guide/User Guide/FAQ.md
vendored
25
docs/User Guide/User Guide/FAQ.md
vendored
@ -54,4 +54,27 @@ More detailed answer:
|
||||
* files are stored in no particular order and user can't change this
|
||||
* Trilium allows storing note [attributes](Advanced%20Usage/Attributes.md) which could be represented in extended user attributes but their support differs greatly among different filesystems / operating systems
|
||||
* Trilium makes links / relations between different notes which can be quickly retrieved / navigated (e.g. for [note map](Advanced%20Usage/Note%20Map%20\(Link%20map%2C%20Tree%20map\).md)). There's no such support in file systems which means these would have to be stored in some kind of side-car files (mini-databases).
|
||||
* Filesystems are generally not transactional. While this is not completely required for a note-taking application, having transactions make it way easier to keep notes and their metadata in predictable and consistent state.
|
||||
* Filesystems are generally not transactional. While this is not completely required for a note-taking application, having transactions make it way easier to keep notes and their metadata in predictable and consistent state.
|
||||
|
||||
## Search-related Questions
|
||||
|
||||
### Why does search sometimes find results with typos?
|
||||
|
||||
Trilium uses a progressive search strategy that includes fuzzy matching when exact matches return fewer than 5 results. This finds notes despite minor typos in your search query. You can use fuzzy search operators (`~=` for fuzzy exact match and `~*` for fuzzy contains). See the <a class="reference-link" href="Basic%20Concepts%20and%20Features/Navigation/Search.md">Search</a> documentation for details.
|
||||
|
||||
### How can I search for notes when I'm not sure of the exact spelling?
|
||||
|
||||
Use the fuzzy search operators:
|
||||
- `#title ~= "projct"` - finds notes with titles like "project" despite the typo
|
||||
- `note.content ~* "algoritm"` - finds content containing "algorithm" or similar words
|
||||
|
||||
### Why do some search results appear before others with lower scores?
|
||||
|
||||
Trilium places exact matches before fuzzy matches. When you search for "project", notes containing exactly "project" appear before notes with variations like "projects" or "projection", regardless of other scoring factors.
|
||||
|
||||
### How can I make my searches faster?
|
||||
|
||||
1. Use the "Fast search" option to search only titles and attributes (not content)
|
||||
2. Limit search scope using the "Ancestor" field
|
||||
3. Set a result limit to prevent loading too many results
|
||||
4. For large databases, consider archiving old notes to reduce search scope
|
Loading…
x
Reference in New Issue
Block a user