mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 10:55:55 +01:00
Merge remote-tracking branch 'origin/main' into react/note_context_aware
This commit is contained in:
@@ -1,24 +1,29 @@
|
||||
<p>Trilium supports configuration via a file named <code>config.ini</code> and environment variables. This document provides a comprehensive reference for all configuration options.</p>
|
||||
|
||||
<p>Trilium supports configuration via a file named <code>config.ini</code> and
|
||||
environment variables. This document provides a comprehensive reference
|
||||
for all configuration options.</p>
|
||||
<h2>Configuration Precedence</h2>
|
||||
<p>Configuration values are loaded in the following order of precedence (highest to lowest):</p>
|
||||
<p>Configuration values are loaded in the following order of precedence (highest
|
||||
to lowest):</p>
|
||||
<ol>
|
||||
<li><strong>Environment variables</strong> (checked first)</li>
|
||||
<li><strong>config.ini file values</strong></li>
|
||||
<li><strong>Default values</strong></li>
|
||||
<li><strong>config.ini file values</strong>
|
||||
</li>
|
||||
<li><strong>Default values</strong>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<h2>Environment Variable Patterns</h2>
|
||||
<p>Trilium supports multiple environment variable patterns for flexibility. The primary pattern is: <code>TRILIUM_[SECTION]_[KEY]</code></p>
|
||||
<p>Trilium supports multiple environment variable patterns for flexibility.
|
||||
The primary pattern is: <code>TRILIUM_[SECTION]_[KEY]</code>
|
||||
</p>
|
||||
<p>Where:</p>
|
||||
<ul>
|
||||
<li><code>SECTION</code> is the INI section name in UPPERCASE</li>
|
||||
<li><code>KEY</code> is the camelCase configuration key converted to UPPERCASE (e.g., <code>instanceName</code> → <code>INSTANCENAME</code>)</li>
|
||||
<li><code>KEY</code> is the camelCase configuration key converted to UPPERCASE
|
||||
(e.g., <code>instanceName</code> → <code>INSTANCENAME</code>)</li>
|
||||
</ul>
|
||||
<p>Additionally, shorter aliases are available for common configurations (see Alternative Variables section below).</p>
|
||||
|
||||
<p>Additionally, shorter aliases are available for common configurations
|
||||
(see Alternative Variables section below).</p>
|
||||
<h2>Environment Variable Reference</h2>
|
||||
|
||||
<h3>General Section</h3>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -31,31 +36,36 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>TRILIUM_GENERAL_INSTANCENAME</code></td>
|
||||
<td><code>TRILIUM_GENERAL_INSTANCENAME</code>
|
||||
</td>
|
||||
<td>string</td>
|
||||
<td>""</td>
|
||||
<td>Instance name for API identification</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>TRILIUM_GENERAL_NOAUTHENTICATION</code></td>
|
||||
<td><code>TRILIUM_GENERAL_NOAUTHENTICATION</code>
|
||||
</td>
|
||||
<td>boolean</td>
|
||||
<td>false</td>
|
||||
<td>Disable authentication (server only)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>TRILIUM_GENERAL_NOBACKUP</code></td>
|
||||
<td><code>TRILIUM_GENERAL_NOBACKUP</code>
|
||||
</td>
|
||||
<td>boolean</td>
|
||||
<td>false</td>
|
||||
<td>Disable automatic backups</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>TRILIUM_GENERAL_NODESKTOPICON</code></td>
|
||||
<td><code>TRILIUM_GENERAL_NODESKTOPICON</code>
|
||||
</td>
|
||||
<td>boolean</td>
|
||||
<td>false</td>
|
||||
<td>Disable desktop icon creation</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>TRILIUM_GENERAL_READONLY</code></td>
|
||||
<td><code>TRILIUM_GENERAL_READONLY</code>
|
||||
</td>
|
||||
<td>boolean</td>
|
||||
<td>false</td>
|
||||
<td>Enable read-only mode</td>
|
||||
@@ -75,55 +85,64 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>TRILIUM_NETWORK_HOST</code></td>
|
||||
<td><code>TRILIUM_NETWORK_HOST</code>
|
||||
</td>
|
||||
<td>string</td>
|
||||
<td>"0.0.0.0"</td>
|
||||
<td>Server host binding</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>TRILIUM_NETWORK_PORT</code></td>
|
||||
<td><code>TRILIUM_NETWORK_PORT</code>
|
||||
</td>
|
||||
<td>string</td>
|
||||
<td>"3000"</td>
|
||||
<td>Server port</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>TRILIUM_NETWORK_HTTPS</code></td>
|
||||
<td><code>TRILIUM_NETWORK_HTTPS</code>
|
||||
</td>
|
||||
<td>boolean</td>
|
||||
<td>false</td>
|
||||
<td>Enable HTTPS</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>TRILIUM_NETWORK_CERTPATH</code></td>
|
||||
<td><code>TRILIUM_NETWORK_CERTPATH</code>
|
||||
</td>
|
||||
<td>string</td>
|
||||
<td>""</td>
|
||||
<td>SSL certificate path</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>TRILIUM_NETWORK_KEYPATH</code></td>
|
||||
<td><code>TRILIUM_NETWORK_KEYPATH</code>
|
||||
</td>
|
||||
<td>string</td>
|
||||
<td>""</td>
|
||||
<td>SSL key path</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>TRILIUM_NETWORK_TRUSTEDREVERSEPROXY</code></td>
|
||||
<td><code>TRILIUM_NETWORK_TRUSTEDREVERSEPROXY</code>
|
||||
</td>
|
||||
<td>boolean/string</td>
|
||||
<td>false</td>
|
||||
<td>Reverse proxy trust settings</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>TRILIUM_NETWORK_CORSALLOWORIGIN</code></td>
|
||||
<td><code>TRILIUM_NETWORK_CORSALLOWORIGIN</code>
|
||||
</td>
|
||||
<td>string</td>
|
||||
<td>""</td>
|
||||
<td>CORS allowed origins</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>TRILIUM_NETWORK_CORSALLOWMETHODS</code></td>
|
||||
<td><code>TRILIUM_NETWORK_CORSALLOWMETHODS</code>
|
||||
</td>
|
||||
<td>string</td>
|
||||
<td>""</td>
|
||||
<td>CORS allowed methods</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>TRILIUM_NETWORK_CORSALLOWHEADERS</code></td>
|
||||
<td><code>TRILIUM_NETWORK_CORSALLOWHEADERS</code>
|
||||
</td>
|
||||
<td>string</td>
|
||||
<td>""</td>
|
||||
<td>CORS allowed headers</td>
|
||||
@@ -143,7 +162,8 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>TRILIUM_SESSION_COOKIEMAXAGE</code></td>
|
||||
<td><code>TRILIUM_SESSION_COOKIEMAXAGE</code>
|
||||
</td>
|
||||
<td>integer</td>
|
||||
<td>1814400</td>
|
||||
<td>Session cookie max age in seconds (21 days)</td>
|
||||
@@ -163,19 +183,22 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>TRILIUM_SYNC_SYNCSERVERHOST</code></td>
|
||||
<td><code>TRILIUM_SYNC_SYNCSERVERHOST</code>
|
||||
</td>
|
||||
<td>string</td>
|
||||
<td>""</td>
|
||||
<td>Sync server host URL</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>TRILIUM_SYNC_SYNCSERVERTIMEOUT</code></td>
|
||||
<td><code>TRILIUM_SYNC_SYNCSERVERTIMEOUT</code>
|
||||
</td>
|
||||
<td>string</td>
|
||||
<td>"120000"</td>
|
||||
<td>Sync server timeout in milliseconds</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>TRILIUM_SYNC_SYNCPROXY</code></td>
|
||||
<td><code>TRILIUM_SYNC_SYNCPROXY</code>
|
||||
</td>
|
||||
<td>string</td>
|
||||
<td>""</td>
|
||||
<td>Sync proxy URL</td>
|
||||
@@ -195,37 +218,43 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHBASEURL</code></td>
|
||||
<td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHBASEURL</code>
|
||||
</td>
|
||||
<td>string</td>
|
||||
<td>""</td>
|
||||
<td>OAuth/OpenID base URL</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHCLIENTID</code></td>
|
||||
<td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHCLIENTID</code>
|
||||
</td>
|
||||
<td>string</td>
|
||||
<td>""</td>
|
||||
<td>OAuth client ID</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHCLIENTSECRET</code></td>
|
||||
<td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHCLIENTSECRET</code>
|
||||
</td>
|
||||
<td>string</td>
|
||||
<td>""</td>
|
||||
<td>OAuth client secret</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERBASEURL</code></td>
|
||||
<td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERBASEURL</code>
|
||||
</td>
|
||||
<td>string</td>
|
||||
<td>"https://accounts.google.com"</td>
|
||||
<td>"<a href="https://accounts.google.com">https://accounts.google.com</a>"</td>
|
||||
<td>OAuth issuer base URL</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERNAME</code></td>
|
||||
<td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERNAME</code>
|
||||
</td>
|
||||
<td>string</td>
|
||||
<td>"Google"</td>
|
||||
<td>OAuth issuer display name</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERICON</code></td>
|
||||
<td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERICON</code>
|
||||
</td>
|
||||
<td>string</td>
|
||||
<td>""</td>
|
||||
<td>OAuth issuer icon URL</td>
|
||||
@@ -245,7 +274,8 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>TRILIUM_LOGGING_RETENTIONDAYS</code></td>
|
||||
<td><code>TRILIUM_LOGGING_RETENTIONDAYS</code>
|
||||
</td>
|
||||
<td>integer</td>
|
||||
<td>90</td>
|
||||
<td>Number of days to retain log files</td>
|
||||
@@ -254,22 +284,20 @@
|
||||
</table>
|
||||
|
||||
<h2>Alternative Environment Variables</h2>
|
||||
<p>The following alternative environment variable names are also supported and work identically to their longer counterparts:</p>
|
||||
|
||||
<p>The following alternative environment variable names are also supported
|
||||
and work identically to their longer counterparts:</p>
|
||||
<h3>Network CORS Variables</h3>
|
||||
<ul>
|
||||
<li><code>TRILIUM_NETWORK_CORS_ALLOW_ORIGIN</code> (alternative to <code>TRILIUM_NETWORK_CORSALLOWORIGIN</code>)</li>
|
||||
<li><code>TRILIUM_NETWORK_CORS_ALLOW_METHODS</code> (alternative to <code>TRILIUM_NETWORK_CORSALLOWMETHODS</code>)</li>
|
||||
<li><code>TRILIUM_NETWORK_CORS_ALLOW_HEADERS</code> (alternative to <code>TRILIUM_NETWORK_CORSALLOWHEADERS</code>)</li>
|
||||
</ul>
|
||||
|
||||
<h3>Sync Variables</h3>
|
||||
<ul>
|
||||
<li><code>TRILIUM_SYNC_SERVER_HOST</code> (alternative to <code>TRILIUM_SYNC_SYNCSERVERHOST</code>)</li>
|
||||
<li><code>TRILIUM_SYNC_SERVER_TIMEOUT</code> (alternative to <code>TRILIUM_SYNC_SYNCSERVERTIMEOUT</code>)</li>
|
||||
<li><code>TRILIUM_SYNC_SERVER_PROXY</code> (alternative to <code>TRILIUM_SYNC_SYNCPROXY</code>)</li>
|
||||
</ul>
|
||||
|
||||
<h3>OAuth/MFA Variables</h3>
|
||||
<ul>
|
||||
<li><code>TRILIUM_OAUTH_BASE_URL</code> (alternative to <code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHBASEURL</code>)</li>
|
||||
@@ -279,32 +307,30 @@
|
||||
<li><code>TRILIUM_OAUTH_ISSUER_NAME</code> (alternative to <code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERNAME</code>)</li>
|
||||
<li><code>TRILIUM_OAUTH_ISSUER_ICON</code> (alternative to <code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERICON</code>)</li>
|
||||
</ul>
|
||||
|
||||
<h3>Logging Variables</h3>
|
||||
<ul>
|
||||
<li><code>TRILIUM_LOGGING_RETENTION_DAYS</code> (alternative to <code>TRILIUM_LOGGING_RETENTIONDAYS</code>)</li>
|
||||
</ul>
|
||||
|
||||
<h2>Boolean Values</h2>
|
||||
<p>Boolean environment variables accept the following values:</p>
|
||||
<ul>
|
||||
<li><strong>True</strong>: <code>"true"</code>, <code>"1"</code>, <code>1</code></li>
|
||||
<li><strong>False</strong>: <code>"false"</code>, <code>"0"</code>, <code>0</code></li>
|
||||
<li>Any other value defaults to <code>false</code></li>
|
||||
<li><strong>True</strong>: <code>"true"</code>, <code>"1"</code>, <code>1</code>
|
||||
</li>
|
||||
<li><strong>False</strong>: <code>"false"</code>, <code>"0"</code>, <code>0</code>
|
||||
</li>
|
||||
<li>Any other value defaults to <code>false</code>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2>Using Environment Variables</h2>
|
||||
<p>Both naming patterns are fully supported and can be used interchangeably:</p>
|
||||
<ul>
|
||||
<li>The longer format follows the section/key pattern for consistency with the INI file structure</li>
|
||||
<li>The longer format follows the section/key pattern for consistency with
|
||||
the INI file structure</li>
|
||||
<li>The shorter alternatives provide convenience for common configurations</li>
|
||||
<li>You can use whichever format you prefer - both are equally valid</li>
|
||||
</ul>
|
||||
|
||||
<h2>Examples</h2>
|
||||
|
||||
<h3>Docker Compose Example</h3>
|
||||
<pre><code class="language-yaml">services:
|
||||
<h3>Docker Compose Example</h3><pre><code class="language-text-x-yaml">services:
|
||||
trilium:
|
||||
image: triliumnext/notes
|
||||
environment:
|
||||
@@ -319,9 +345,7 @@
|
||||
# TRILIUM_NETWORK_CORS_ALLOW_ORIGIN: "https://myapp.com"
|
||||
# TRILIUM_SYNC_SERVER_HOST: "https://sync.example.com"
|
||||
# TRILIUM_OAUTH_BASE_URL: "https://auth.example.com"</code></pre>
|
||||
|
||||
<h3>Shell Export Example</h3>
|
||||
<pre><code class="language-bash"># Using either format
|
||||
<h3>Shell Export Example</h3><pre><code class="language-text-x-sh"># Using either format
|
||||
export TRILIUM_GENERAL_NOAUTHENTICATION=false
|
||||
export TRILIUM_NETWORK_HTTPS=true
|
||||
export TRILIUM_NETWORK_CERTPATH=/path/to/cert.pem
|
||||
@@ -330,6 +354,7 @@ export TRILIUM_LOGGING_RETENTIONDAYS=30
|
||||
|
||||
# Start Trilium
|
||||
npm start</code></pre>
|
||||
|
||||
<h2>config.ini Reference</h2>
|
||||
<p>For the complete list of configuration options and their INI file format, please review the <a href="https://github.com/TriliumNext/Trilium/blob/main/apps/server/src/assets/config-sample.ini">config-sample.ini</a> file in the Trilium repository.</p>
|
||||
<p>For the complete list of configuration options and their INI file format,
|
||||
please review the <a href="https://github.com/TriliumNext/Trilium/blob/main/apps/server/src/assets/config-sample.ini">config-sample.ini</a> file
|
||||
in the Trilium repository</p>
|
||||
@@ -5,18 +5,19 @@
|
||||
<p>The <em>Quick search</em> 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.</p>
|
||||
<p>The alternative to the quick search is the <a class="reference-link" href="#root/_help_eIg8jdvaoNNd">Search</a> function,
|
||||
which opens in a dedicated tab and has support for advanced queries.</p>
|
||||
<p>For even faster navigation, it's possible to use <a class="reference-link"
|
||||
href="#root/_help_F1r9QtzQLZqm">Jump to Note</a> which will only search
|
||||
<p>The alternative to the quick search is the <a class="reference-link"
|
||||
href="#root/_help_eIg8jdvaoNNd">Search</a> function, which opens in
|
||||
a dedicated tab and has support for advanced queries.</p>
|
||||
<p>For even faster navigation, it's possible to use <a class="reference-link"
|
||||
href="#root/_help_F1r9QtzQLZqm">Jump to...</a> which will only search
|
||||
through the note titles instead of the content.</p>
|
||||
<h2>Layout</h2>
|
||||
<p>Based on the <a class="reference-link" href="#root/_help_x0JgW8UqGXvq">Vertical and horizontal layout</a>,
|
||||
<p>Based on the <a class="reference-link" href="#root/_help_x0JgW8UqGXvq">Vertical and horizontal layout</a>,
|
||||
the quick search is placed:</p>
|
||||
<ul>
|
||||
<li>On the vertical layout, it is displayed right above the <a class="reference-link"
|
||||
<li data-list-item-id="eb498e0518c4efc433c9569270c9c7a5c">On the vertical layout, it is displayed right above the <a class="reference-link"
|
||||
href="#root/_help_oPVyFC7WL2Lp">Note Tree</a>.</li>
|
||||
<li>On the horizontal layout, it is displayed in the <a class="reference-link"
|
||||
<li data-list-item-id="e6a9159606a513e839ca71ff4735857bb">On the horizontal layout, it is displayed in the <a class="reference-link"
|
||||
href="#root/_help_xYmIYSP6wE3F">Launch Bar</a>, where it can be positioned
|
||||
just like any other icon.</li>
|
||||
</ul>
|
||||
@@ -30,37 +31,120 @@
|
||||
<h3>Infinite Scrolling</h3>
|
||||
<p>Results are loaded progressively as you scroll:</p>
|
||||
<ul>
|
||||
<li>Initial display shows 15 results</li>
|
||||
<li>Scrolling near the bottom automatically loads 10 more results</li>
|
||||
<li>Continue scrolling to load all matching notes</li>
|
||||
<li data-list-item-id="e6d151aab6b52d08e9a93e6f9c29c081a">Initial display shows 15 results</li>
|
||||
<li data-list-item-id="e006eeac7574a398324f214edcb9a383b">Scrolling near the bottom automatically loads 10 more results</li>
|
||||
<li
|
||||
data-list-item-id="e5f6fcb1ec0d496fcf599fa90c3911c89">Continue scrolling to load all matching notes</li>
|
||||
</ul>
|
||||
<h3>Visual Features</h3>
|
||||
<ul>
|
||||
<li><strong>Highlighting</strong>: Search terms appear in bold with accent
|
||||
<li data-list-item-id="e44f3402a55ac37c63abae20490d66d70"><strong>Highlighting</strong>: Search terms appear in bold with accent
|
||||
colors</li>
|
||||
<li><strong>Separation</strong>: Results are separated with dividers</li>
|
||||
<li><strong>Theme Support</strong>: Highlighting colors adapt to light/dark
|
||||
<li data-list-item-id="e1c8743ac639f15750171788790df2bb0"><strong>Separation</strong>: Results are separated with dividers</li>
|
||||
<li
|
||||
data-list-item-id="ec5c5dbaa44ba426d220718804b9b27db"><strong>Theme Support</strong>: Highlighting colors adapt to light/dark
|
||||
themes</li>
|
||||
</ul>
|
||||
<h3>Search Behavior</h3>
|
||||
<p>Quick search uses progressive search:</p>
|
||||
<ol>
|
||||
<li>Shows exact matches first</li>
|
||||
<li>Includes fuzzy matches when exact results are fewer than 5</li>
|
||||
<li>Exact matches appear before fuzzy matches</li>
|
||||
<li data-list-item-id="e9a34edaccc0174140e1183c5e43a2327">Shows exact matches first</li>
|
||||
<li data-list-item-id="e5b751c044ae5189095fd08655a55372f">Includes fuzzy matches when exact results are fewer than 5</li>
|
||||
<li data-list-item-id="ee63c39a04b7511cd4e031cdd963f58d2">Exact matches appear before fuzzy matches</li>
|
||||
</ol>
|
||||
<h3>Keyboard Navigation</h3>
|
||||
<ul>
|
||||
<li>Press <code>Enter</code> to open the first result</li>
|
||||
<li>Use arrow keys to navigate through results</li>
|
||||
<li>Press <code>Escape</code> to close the quick search</li>
|
||||
<li data-list-item-id="e1161754a60afdea3656561abcb46f9ea">Press <code>Enter</code> to open the first result</li>
|
||||
<li data-list-item-id="ebdffa32bcd3d8e24c3938b472521034d">Use arrow keys to navigate through results</li>
|
||||
<li data-list-item-id="eed08e1e6867dcef7eaa6ce7a21fd5e02">Press <code>Escape</code> to close the quick search</li>
|
||||
</ul>
|
||||
<h2>Using Quick Search</h2>
|
||||
<ol>
|
||||
<li><strong>Typo tolerance</strong>: Search finds results despite minor typos</li>
|
||||
<li><strong>Content previews</strong>: 200-character snippets show match context</li>
|
||||
<li><strong>Infinite scrolling</strong>: Additional results load on scroll</li>
|
||||
<li><strong>Specific terms</strong>: Specific search terms return more focused
|
||||
results</li>
|
||||
<li><strong>Match locations</strong>: Bold text indicates where matches occur</li>
|
||||
</ol>
|
||||
<li data-list-item-id="e88738101cdad95c7ffe2fc45d19250b7"><strong>Typo tolerance</strong>: Search finds results despite minor typos</li>
|
||||
<li
|
||||
data-list-item-id="ead4c50c8ae5e86987073741285271140"><strong>Content previews</strong>: 200-character snippets show match context</li>
|
||||
<li
|
||||
data-list-item-id="ee135ac66eafef5962b5221fa149dc31c"><strong>Infinite scrolling</strong>: Additional results load on scroll</li>
|
||||
<li
|
||||
data-list-item-id="ebecf1647bb3e6631383fa1cad5e0d222"><strong>Specific terms</strong>: Specific search terms return more focused
|
||||
results</li>
|
||||
<li data-list-item-id="e7d6ee3a67dbf55e7c72788cde795f2b2"><strong>Match locations</strong>: Bold text indicates where matches occur</li>
|
||||
</ol>
|
||||
<h2>Quick Search - Exact Match Operator</h2>
|
||||
<p>Quick Search now supports the exact match operator (<code>=</code>) at
|
||||
the beginning of your search query. This allows you to search for notes
|
||||
where the title or content exactly matches your search term, rather than
|
||||
just containing it.</p>
|
||||
<h3>Usage</h3>
|
||||
<p>To use exact match in Quick Search:</p>
|
||||
<ol>
|
||||
<li data-list-item-id="e98c91a13502a0ddd321432cd2cdab193">Start your search query with the <code>=</code> operator</li>
|
||||
<li data-list-item-id="e0db9fc3f530c8e0eb96f4df5ef74d955">Follow it immediately with your search term (no space after <code>=</code>)</li>
|
||||
</ol>
|
||||
<h4>Examples</h4>
|
||||
<ul>
|
||||
<li data-list-item-id="e188d5c0a39291e2f665072b02b4b6cc0"><code>=example</code> - Finds notes with title exactly "example" or content
|
||||
exactly "example"</li>
|
||||
<li data-list-item-id="e275568bc5123c979fddff51fac370983"><code>=Project Plan</code> - Finds notes with title exactly "Project Plan"
|
||||
or content exactly "Project Plan"</li>
|
||||
<li data-list-item-id="e04c10070d9800148f641efcbee16ab3d"><code>='hello world'</code> - Use quotes for multi-word exact matches</li>
|
||||
</ul>
|
||||
<h4>Comparison with Regular Search</h4>
|
||||
<figure class="table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Query</th>
|
||||
<th>Behavior</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>example</code>
|
||||
</td>
|
||||
<td>Finds all notes containing "example" anywhere in title or content</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>=example</code>
|
||||
</td>
|
||||
<td>Finds only notes where the title equals "example" or content equals "example"
|
||||
exactly</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</figure>
|
||||
<h3>Technical Details</h3>
|
||||
<p>When you use the <code>=</code> operator:</p>
|
||||
<ul>
|
||||
<li data-list-item-id="ebd357e2f6afa77ccb3aed347103d47c3">The search performs an exact match on note titles</li>
|
||||
<li data-list-item-id="e64c84d77017e4cd43fe95c0e4f537044">For note content, it looks for exact matches of the entire content</li>
|
||||
<li
|
||||
data-list-item-id="ef4f790816f24b9484fea127837025935">Partial word matches are excluded</li>
|
||||
<li data-list-item-id="e94a53c59dc4f1a8bef101df66538d06a">The search is case-insensitive</li>
|
||||
</ul>
|
||||
<h3>Limitations</h3>
|
||||
<ul>
|
||||
<li data-list-item-id="e4ed2c12de6681eb26d2ec2daa1985956">The <code>=</code> operator must be at the very beginning of the search
|
||||
query</li>
|
||||
<li data-list-item-id="e30845adb77a12106475b88b68b614009">Spaces after <code>=</code> will treat it as a regular search</li>
|
||||
<li data-list-item-id="e89322d60b3f5cb6b2b318cc7247721cf">Multiple <code>=</code> operators (like <code>==example</code>) are treated
|
||||
as regular text search</li>
|
||||
</ul>
|
||||
<h3>Use Cases</h3>
|
||||
<p>This feature is particularly useful when:</p>
|
||||
<ul>
|
||||
<li data-list-item-id="eb23079c90785534a68963977e993d253">You know the exact title of a note</li>
|
||||
<li data-list-item-id="e92f02cb8b28fc02f264ebeb09376af91">You want to find notes with specific, complete content</li>
|
||||
<li data-list-item-id="e37aa1707a8440213fe404d1ed7a2e941">You need to distinguish between notes with similar but not identical titles</li>
|
||||
<li
|
||||
data-list-item-id="e8b04a0a97aa970e6984370ff17160208">You want to avoid false positives from partial matches</li>
|
||||
</ul>
|
||||
<h3>Related Features</h3>
|
||||
<ul>
|
||||
<li data-list-item-id="e3d0656590d49c6e09ae5f39a0a773dff">For more complex exact matching queries, use the full <a href="Search.md">Search</a> functionality</li>
|
||||
<li
|
||||
data-list-item-id="e7d77021ebedb1b1d25e8bfe2726af21e">For fuzzy matching (finding results despite typos), use the <code>~=</code> operator
|
||||
in the full search</li>
|
||||
<li data-list-item-id="eabcf1ff7a9dfa822192ee9afe3268469">For partial matches with wildcards, use operators like <code>*=*</code>, <code>=*</code>,
|
||||
or <code>*=</code> in the full search</li>
|
||||
</ul>
|
||||
@@ -134,7 +134,8 @@ docker run -d --name trilium -p 8080:8080 --user $(id -u):$(id -g) -v ~/trilium-
|
||||
<li><code>TRILIUM_DATA_DIR</code>: Path to the data directory inside the container
|
||||
(default: <code>/home/node/trilium-data</code>)</li>
|
||||
</ul>
|
||||
<p>For a complete list of configuration environment variables (network settings, authentication, sync, etc.), see <a class="reference-link" href="#root/_help_Gzjqa934BdH4">Configuration (config.ini or environment variables)</a>.</p>
|
||||
<p>For a complete list of configuration environment variables (network settings,
|
||||
authentication, sync, etc.), see <a class="reference-link" href="#root/_help_dmi3wz9muS2O">Configuration (config.ini or environment variables)</a>.</p>
|
||||
<h3>Volume Permissions</h3>
|
||||
<p>If you encounter permission issues with the data volume, ensure that:</p>
|
||||
<ol>
|
||||
|
||||
@@ -51,8 +51,10 @@ class="admonition warning">
|
||||
<ol>
|
||||
<li>You can also setup through environment variables:
|
||||
<ul>
|
||||
<li>Standard: <code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHBASEURL</code>, <code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHCLIENTID</code>, <code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHCLIENTSECRET</code></li>
|
||||
<li>Legacy (still supported): <code>TRILIUM_OAUTH_BASE_URL</code>, <code>TRILIUM_OAUTH_CLIENT_ID</code>, <code>TRILIUM_OAUTH_CLIENT_SECRET</code></li>
|
||||
<li>Standard: <code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHBASEURL</code>, <code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHCLIENTID</code>, <code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHCLIENTSECRET</code>
|
||||
</li>
|
||||
<li>Legacy (still supported): <code>TRILIUM_OAUTH_BASE_URL</code>, <code>TRILIUM_OAUTH_CLIENT_ID</code>, <code>TRILIUM_OAUTH_CLIENT_SECRET</code>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><code>oauthBaseUrl</code> should be the link of your Trilium instance server,
|
||||
@@ -69,13 +71,15 @@ class="admonition warning">
|
||||
<p>The default OAuth issuer is Google. To use other services such as Authentik
|
||||
or Auth0, you can configure the settings via <code>oauthIssuerBaseUrl</code>, <code>oauthIssuerName</code>,
|
||||
and <code>oauthIssuerIcon</code> in the <code>config.ini</code> file. Alternatively,
|
||||
these values can be set using environment variables:
|
||||
<ul>
|
||||
<li>Standard: <code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERBASEURL</code>, <code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERNAME</code>, <code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERICON</code></li>
|
||||
<li>Legacy (still supported): <code>TRILIUM_OAUTH_ISSUER_BASE_URL</code>, <code>TRILIUM_OAUTH_ISSUER_NAME</code>, <code>TRILIUM_OAUTH_ISSUER_ICON</code></li>
|
||||
</ul>
|
||||
<code>oauthIssuerName</code> and <code>oauthIssuerIcon</code> are
|
||||
required for displaying correct issuer information at the Login page.</p>
|
||||
these values can be set using environment variables:</p>
|
||||
<ul>
|
||||
<li>Standard: <code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERBASEURL</code>, <code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERNAME</code>, <code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERICON</code>
|
||||
</li>
|
||||
<li>Legacy (still supported): <code>TRILIUM_OAUTH_ISSUER_BASE_URL</code>, <code>TRILIUM_OAUTH_ISSUER_NAME</code>, <code>TRILIUM_OAUTH_ISSUER_ICON</code>
|
||||
</li>
|
||||
</ul>
|
||||
<p><code>oauthIssuerName</code> and <code>oauthIssuerIcon</code> are required
|
||||
for displaying correct issuer information at the Login page.</p>
|
||||
</aside>
|
||||
<h4>Authentik</h4>
|
||||
<p>If you don’t already have a running Authentik instance, please follow
|
||||
|
||||
@@ -26,8 +26,8 @@ https=true
|
||||
certPath=/[username]/.acme.sh/[hostname]/fullchain.cer
|
||||
keyPath=/[username]/.acme.sh/[hostname]/example.com.key</code></pre>
|
||||
<p>You can also review the <a href="#root/_help_Gzjqa934BdH4">configuration</a> file
|
||||
to provide all <code>config.ini</code> values as environment variables instead. For example, you can configure TLS using environment variables:</p>
|
||||
<pre><code class="language-bash">export TRILIUM_NETWORK_HTTPS=true
|
||||
to provide all <code>config.ini</code> values as environment variables instead.
|
||||
For example, you can configure TLS using environment variables:</p><pre><code class="language-text-x-sh">export TRILIUM_NETWORK_HTTPS=true
|
||||
export TRILIUM_NETWORK_CERTPATH=/path/to/cert.pem
|
||||
export TRILIUM_NETWORK_KEYPATH=/path/to/key.pem</code></pre>
|
||||
<p>The above example shows how this is set up in an environment where the
|
||||
|
||||
@@ -159,6 +159,7 @@ function checkCredentials(req: Request, res: Response, next: NextFunction) {
|
||||
|
||||
if (!passwordEncryptionService.verifyPassword(password)) {
|
||||
res.setHeader("Content-Type", "text/plain").status(401).send("Incorrect password");
|
||||
log.info(`WARNING: Wrong password from ${req.ip}, rejecting.`);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
|
||||
@@ -59,6 +59,34 @@ describe("Lexer fulltext", () => {
|
||||
it("escaping special characters", () => {
|
||||
expect(lex("hello \\#\\~\\'").fulltextTokens.map((t) => t.token)).toEqual(["hello", "#~'"]);
|
||||
});
|
||||
|
||||
it("recognizes leading = operator for exact match", () => {
|
||||
const result1 = lex("=example");
|
||||
expect(result1.fulltextTokens.map((t) => t.token)).toEqual(["example"]);
|
||||
expect(result1.leadingOperator).toBe("=");
|
||||
|
||||
const result2 = lex("=hello world");
|
||||
expect(result2.fulltextTokens.map((t) => t.token)).toEqual(["hello", "world"]);
|
||||
expect(result2.leadingOperator).toBe("=");
|
||||
|
||||
const result3 = lex("='hello world'");
|
||||
expect(result3.fulltextTokens.map((t) => t.token)).toEqual(["hello world"]);
|
||||
expect(result3.leadingOperator).toBe("=");
|
||||
});
|
||||
|
||||
it("doesn't treat = as leading operator in other contexts", () => {
|
||||
const result1 = lex("==example");
|
||||
expect(result1.fulltextTokens.map((t) => t.token)).toEqual(["==example"]);
|
||||
expect(result1.leadingOperator).toBe("");
|
||||
|
||||
const result2 = lex("= example");
|
||||
expect(result2.fulltextTokens.map((t) => t.token)).toEqual(["=", "example"]);
|
||||
expect(result2.leadingOperator).toBe("");
|
||||
|
||||
const result3 = lex("example");
|
||||
expect(result3.fulltextTokens.map((t) => t.token)).toEqual(["example"]);
|
||||
expect(result3.leadingOperator).toBe("");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Lexer expression", () => {
|
||||
|
||||
@@ -10,10 +10,18 @@ function lex(str: string) {
|
||||
let quotes: boolean | string = false; // otherwise contains used quote - ', " or `
|
||||
let fulltextEnded = false;
|
||||
let currentWord = "";
|
||||
let leadingOperator = "";
|
||||
|
||||
function isSymbolAnOperator(chr: string) {
|
||||
return ["=", "*", ">", "<", "!", "-", "+", "%", ","].includes(chr);
|
||||
}
|
||||
|
||||
// Check if the string starts with an exact match operator
|
||||
// This allows users to use "=searchterm" for exact matching
|
||||
if (str.startsWith("=") && str.length > 1 && str[1] !== "=" && str[1] !== " ") {
|
||||
leadingOperator = "=";
|
||||
str = str.substring(1); // Remove the leading operator from the string
|
||||
}
|
||||
|
||||
function isPreviousSymbolAnOperator() {
|
||||
if (currentWord.length === 0) {
|
||||
@@ -128,7 +136,8 @@ function lex(str: string) {
|
||||
return {
|
||||
fulltextQuery,
|
||||
fulltextTokens,
|
||||
expressionTokens
|
||||
expressionTokens,
|
||||
leadingOperator
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import type SearchContext from "../search_context.js";
|
||||
import type { TokenData, TokenStructure } from "./types.js";
|
||||
import type Expression from "../expressions/expression.js";
|
||||
|
||||
function getFulltext(_tokens: TokenData[], searchContext: SearchContext) {
|
||||
function getFulltext(_tokens: TokenData[], searchContext: SearchContext, leadingOperator?: string) {
|
||||
const tokens: string[] = _tokens.map((t) => removeDiacritic(t.token));
|
||||
|
||||
searchContext.highlightedTokens.push(...tokens);
|
||||
@@ -33,8 +33,19 @@ function getFulltext(_tokens: TokenData[], searchContext: SearchContext) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// If user specified "=" at the beginning, they want exact match
|
||||
const operator = leadingOperator === "=" ? "=" : "*=*";
|
||||
|
||||
if (!searchContext.fastSearch) {
|
||||
return new OrExp([new NoteFlatTextExp(tokens), new NoteContentFulltextExp("*=*", { tokens, flatText: true })]);
|
||||
// For exact match with "=", we need different behavior
|
||||
if (leadingOperator === "=" && tokens.length === 1) {
|
||||
// Exact match on title OR exact match on content
|
||||
return new OrExp([
|
||||
new PropertyComparisonExp(searchContext, "title", "=", tokens[0]),
|
||||
new NoteContentFulltextExp("=", { tokens, flatText: false })
|
||||
]);
|
||||
}
|
||||
return new OrExp([new NoteFlatTextExp(tokens), new NoteContentFulltextExp(operator, { tokens, flatText: true })]);
|
||||
} else {
|
||||
return new NoteFlatTextExp(tokens);
|
||||
}
|
||||
@@ -428,9 +439,10 @@ export interface ParseOpts {
|
||||
expressionTokens: TokenStructure;
|
||||
searchContext: SearchContext;
|
||||
originalQuery?: string;
|
||||
leadingOperator?: string;
|
||||
}
|
||||
|
||||
function parse({ fulltextTokens, expressionTokens, searchContext }: ParseOpts) {
|
||||
function parse({ fulltextTokens, expressionTokens, searchContext, leadingOperator }: ParseOpts) {
|
||||
let expression: Expression | undefined | null;
|
||||
|
||||
try {
|
||||
@@ -444,7 +456,7 @@ function parse({ fulltextTokens, expressionTokens, searchContext }: ParseOpts) {
|
||||
let exp = AndExp.of([
|
||||
searchContext.includeArchivedNotes ? null : new PropertyComparisonExp(searchContext, "isarchived", "=", "false"),
|
||||
getAncestorExp(searchContext),
|
||||
getFulltext(fulltextTokens, searchContext),
|
||||
getFulltext(fulltextTokens, searchContext, leadingOperator),
|
||||
expression
|
||||
]);
|
||||
|
||||
|
||||
@@ -234,6 +234,28 @@ describe("Search", () => {
|
||||
expect(findNoteByTitle(searchResults, "Austria")).toBeTruthy();
|
||||
});
|
||||
|
||||
it("leading = operator for exact match", () => {
|
||||
rootNote
|
||||
.child(note("Example Note").label("type", "document"))
|
||||
.child(note("Examples of Usage").label("type", "tutorial"))
|
||||
.child(note("Sample").label("type", "example"));
|
||||
|
||||
const searchContext = new SearchContext();
|
||||
|
||||
// Using leading = for exact title match
|
||||
let searchResults = searchService.findResultsWithQuery("=Example Note", searchContext);
|
||||
expect(searchResults.length).toEqual(1);
|
||||
expect(findNoteByTitle(searchResults, "Example Note")).toBeTruthy();
|
||||
|
||||
// Without =, it should find all notes containing "example"
|
||||
searchResults = searchService.findResultsWithQuery("example", searchContext);
|
||||
expect(searchResults.length).toEqual(3);
|
||||
|
||||
// = operator should not match partial words
|
||||
searchResults = searchService.findResultsWithQuery("=Example", searchContext);
|
||||
expect(searchResults.length).toEqual(0);
|
||||
});
|
||||
|
||||
it("fuzzy attribute search", () => {
|
||||
rootNote.child(note("Europe")
|
||||
.label("country", "", true)
|
||||
|
||||
@@ -367,7 +367,7 @@ function mergeExactAndFuzzyResults(exactResults: SearchResult[], fuzzyResults: S
|
||||
}
|
||||
|
||||
function parseQueryToExpression(query: string, searchContext: SearchContext) {
|
||||
const { fulltextQuery, fulltextTokens, expressionTokens } = lex(query);
|
||||
const { fulltextQuery, fulltextTokens, expressionTokens, leadingOperator } = lex(query);
|
||||
searchContext.fulltextQuery = fulltextQuery;
|
||||
|
||||
let structuredExpressionTokens: TokenStructure;
|
||||
@@ -383,7 +383,8 @@ function parseQueryToExpression(query: string, searchContext: SearchContext) {
|
||||
fulltextTokens,
|
||||
expressionTokens: structuredExpressionTokens,
|
||||
searchContext,
|
||||
originalQuery: query
|
||||
originalQuery: query,
|
||||
leadingOperator
|
||||
});
|
||||
|
||||
if (searchContext.debug) {
|
||||
|
||||
Reference in New Issue
Block a user