#74 - boost unmarked tags
This commit is contained in:
@@ -96,13 +96,15 @@ async function getAndMapIndexedDocument(
|
||||
}
|
||||
}
|
||||
|
||||
const tags = getTagsFromMetadata(metadata)
|
||||
return {
|
||||
basename: removeDiacritics(file.basename),
|
||||
content,
|
||||
path: file.path,
|
||||
mtime: file.stat.mtime,
|
||||
|
||||
tags: getTagsFromMetadata(metadata),
|
||||
tags: tags,
|
||||
unmarkedTags: tags.map(t => t.replace('#', '')),
|
||||
aliases: getAliasesFromMetadata(metadata).join(''),
|
||||
headings1: metadata ? extractHeadingsFromCache(metadata, 1).join(' ') : '',
|
||||
headings2: metadata ? extractHeadingsFromCache(metadata, 2).join(' ') : '',
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
class:is-selected={selected}
|
||||
on:mousemove
|
||||
on:click
|
||||
on:keypress
|
||||
on:auxclick>
|
||||
{#if glyph}
|
||||
<GlyphAddNote />
|
||||
|
||||
@@ -42,6 +42,7 @@ export type IndexedDocument = {
|
||||
content: string
|
||||
aliases: string
|
||||
tags: string[]
|
||||
unmarkedTags: string[]
|
||||
headings1: string
|
||||
headings2: string
|
||||
headings3: string
|
||||
|
||||
@@ -196,6 +196,7 @@ export class Omnisearch {
|
||||
headings1: settings.weightH1,
|
||||
headings2: settings.weightH2,
|
||||
headings3: settings.weightH3,
|
||||
unmarkedTags: settings.weightUnmarkedTags
|
||||
},
|
||||
})
|
||||
|
||||
@@ -210,7 +211,6 @@ export class Omnisearch {
|
||||
ext.startsWith(e.startsWith('.') ? e : '.' + e)
|
||||
)
|
||||
})
|
||||
console.log(query.query.ext, results.length)
|
||||
}
|
||||
|
||||
// Filter query results that match the path
|
||||
|
||||
@@ -7,7 +7,11 @@ import {
|
||||
} from 'obsidian'
|
||||
import { writable } from 'svelte/store'
|
||||
import { database } from './database'
|
||||
import { K_DISABLE_OMNISEARCH, getTextExtractor, isCacheEnabled } from './globals'
|
||||
import {
|
||||
K_DISABLE_OMNISEARCH,
|
||||
getTextExtractor,
|
||||
isCacheEnabled,
|
||||
} from './globals'
|
||||
import type OmnisearchPlugin from './main'
|
||||
|
||||
interface WeightingSettings {
|
||||
@@ -16,6 +20,7 @@ interface WeightingSettings {
|
||||
weightH1: number
|
||||
weightH2: number
|
||||
weightH3: number
|
||||
weightUnmarkedTags: number
|
||||
}
|
||||
|
||||
export interface OmnisearchSettings extends WeightingSettings {
|
||||
@@ -376,6 +381,10 @@ export class SettingsTab extends PluginSettingTab {
|
||||
.setName(`Headings level 3 (default: ${DEFAULT_SETTINGS.weightH3})`)
|
||||
.addSlider(cb => this.weightSlider(cb, 'weightH3'))
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName(`Tags without the # (default: ${DEFAULT_SETTINGS.weightUnmarkedTags})`)
|
||||
.addSlider(cb => this.weightSlider(cb, 'weightUnmarkedTags'))
|
||||
|
||||
//#endregion Results Weighting
|
||||
|
||||
//#region Debugging
|
||||
@@ -473,6 +482,7 @@ export const DEFAULT_SETTINGS: OmnisearchSettings = {
|
||||
weightH1: 1.5,
|
||||
weightH2: 1.3,
|
||||
weightH3: 1.1,
|
||||
weightUnmarkedTags: 1.1,
|
||||
|
||||
welcomeMessage: '',
|
||||
verboseLogging: false,
|
||||
|
||||
Reference in New Issue
Block a user