diff --git a/src/components/ResultItemVault.svelte b/src/components/ResultItemVault.svelte
index 8c33e81..90bbc10 100644
--- a/src/components/ResultItemVault.svelte
+++ b/src/components/ResultItemVault.svelte
@@ -1,5 +1,6 @@
- {@html note.basename.replace(reg, highlighter)}
+ {@html title.replace(reg, highlighter)}
{#if matches.length > 0}
diff --git a/src/search.ts b/src/search.ts
index ea14ee6..74bcd37 100644
--- a/src/search.ts
+++ b/src/search.ts
@@ -252,7 +252,7 @@ export async function addToIndex(file: TAbstractFile): Promise {
// Make the document and index it
const note: IndexedNote = {
- basename: file.path,
+ basename: file.basename,
content,
path: file.path,
aliases: getAliasesFromMetadata(metadata).join(''),
diff --git a/src/settings.ts b/src/settings.ts
index eceb548..417b0e7 100644
--- a/src/settings.ts
+++ b/src/settings.ts
@@ -9,9 +9,10 @@ interface WeightingSettings {
}
export interface OmnisearchSettings extends WeightingSettings {
- showIndexingNotices: boolean
respectExcluded: boolean
reindexInRealTime: boolean
+ showIndexingNotices: boolean
+ showShortName: boolean
CtrlJK: boolean
CtrlNP: boolean
}
@@ -28,19 +29,31 @@ export class SettingsTab extends PluginSettingTab {
const { containerEl } = this
containerEl.empty()
- // Title
+ // Settings main title
containerEl.createEl('h2', { text: 'Omnisearch settings' })
- // Show notices
- new Setting(containerEl)
- .setName('Show indexing notices')
- .setDesc('Show a notice when indexing is done, usually at startup.')
- .addToggle(toggle =>
- toggle.setValue(settings.showIndexingNotices).onChange(async v => {
- settings.showIndexingNotices = v
- await saveSettings(this.plugin)
- }),
- )
+ // #region Behavior
+
+ new Setting(containerEl).setName('Behavior').setHeading()
+
+ // Index in real-time, desktop only
+ if (require('electron')) {
+ new Setting(containerEl)
+ .setName('Reindex in real-time')
+ .setDesc(
+ "By default, notes a reindexed when Obsidian focus is lost. Enable this to reindex in real-time. May affect Obsidian's performances when editing large notes.",
+ )
+ .addToggle(toggle =>
+ toggle.setValue(settings.reindexInRealTime).onChange(async v => {
+ settings.reindexInRealTime = v
+ await saveSettings(this.plugin)
+ }),
+ )
+ }
+ else {
+ // No real time indexing on mobile
+ settings.reindexInRealTime = false
+ }
// Respect excluded files
new Setting(containerEl)
@@ -55,24 +68,37 @@ export class SettingsTab extends PluginSettingTab {
}),
)
- // Index in real-time, desktop only
- if (require('electron')) {
- new Setting(containerEl)
- .setName('Reindex in real-time')
- .setDesc(
- 'By default, notes a reindexed when Obsidian focus is lost. Enable this to reindex in real-time. May affect performances.',
- )
- .addToggle(toggle =>
- toggle.setValue(settings.reindexInRealTime).onChange(async v => {
- settings.reindexInRealTime = v
- await saveSettings(this.plugin)
- }),
- )
- }
- else {
- // No real time indexing on mobile
- settings.reindexInRealTime = false
- }
+ // #endregion Behavior
+
+ // #region User Interface
+
+ new Setting(containerEl).setName('User Interface').setHeading()
+
+ // Show notices
+ new Setting(containerEl)
+ .setName('Show indexing notices')
+ .setDesc('Show a notice when indexing is done, usually at startup.')
+ .addToggle(toggle =>
+ toggle.setValue(settings.showIndexingNotices).onChange(async v => {
+ settings.showIndexingNotices = v
+ await saveSettings(this.plugin)
+ }),
+ )
+
+ // Display note names without the full path
+ new Setting(containerEl)
+ .setName('Hide full path in results list')
+ .setDesc(
+ 'In the search results, only show the note name, without the full path.',
+ )
+ .addToggle(toggle =>
+ toggle.setValue(settings.showShortName).onChange(async v => {
+ settings.showShortName = v
+ await saveSettings(this.plugin)
+ }),
+ )
+
+ // #endregion User Interface
// #region Results Weighting
@@ -135,10 +161,12 @@ export class SettingsTab extends PluginSettingTab {
}
export const DEFAULT_SETTINGS: OmnisearchSettings = {
- showIndexingNotices: false,
respectExcluded: true,
reindexInRealTime: false,
+ showIndexingNotices: false,
+ showShortName: false,
+
weightBasename: 2,
weightH1: 1.5,
weightH2: 1.3,