Moved recency setting
This commit is contained in:
@@ -57,11 +57,17 @@ export class SettingsTab extends PluginSettingTab {
|
|||||||
`
|
`
|
||||||
|
|
||||||
injectSettingsIndexing(this.plugin, settings, containerEl)
|
injectSettingsIndexing(this.plugin, settings, containerEl)
|
||||||
|
containerEl.createEl('hr')
|
||||||
injectSettingsBehavior(this.plugin, settings, containerEl)
|
injectSettingsBehavior(this.plugin, settings, containerEl)
|
||||||
|
containerEl.createEl('hr')
|
||||||
injectSettingsUserInterface(this.plugin, settings, containerEl)
|
injectSettingsUserInterface(this.plugin, settings, containerEl)
|
||||||
|
containerEl.createEl('hr')
|
||||||
injectSettingsWeighting(this.plugin, settings, containerEl, this.display)
|
injectSettingsWeighting(this.plugin, settings, containerEl, this.display)
|
||||||
|
containerEl.createEl('hr')
|
||||||
injectSettingsHttp(this.plugin, settings, containerEl)
|
injectSettingsHttp(this.plugin, settings, containerEl)
|
||||||
|
containerEl.createEl('hr')
|
||||||
injectSettingsDanger(this.plugin, settings, containerEl)
|
injectSettingsDanger(this.plugin, settings, containerEl)
|
||||||
|
containerEl.createEl('hr')
|
||||||
|
|
||||||
//#region Debugging
|
//#region Debugging
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import type { OmnisearchSettings } from './utils'
|
|||||||
import { saveSettings } from './utils'
|
import { saveSettings } from './utils'
|
||||||
import { htmlDescription, needsARestart } from './utils'
|
import { htmlDescription, needsARestart } from './utils'
|
||||||
import type OmnisearchPlugin from 'src/main'
|
import type OmnisearchPlugin from 'src/main'
|
||||||
import { RecencyCutoff } from 'src/globals'
|
|
||||||
import { getCtrlKeyLabel } from 'src/tools/utils'
|
import { getCtrlKeyLabel } from 'src/tools/utils'
|
||||||
|
|
||||||
export function injectSettingsBehavior(
|
export function injectSettingsBehavior(
|
||||||
@@ -53,26 +52,6 @@ export function injectSettingsBehavior(
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
new Setting(containerEl)
|
|
||||||
.setName('Recency boost (experimental)')
|
|
||||||
.setDesc(
|
|
||||||
'Files that have been modified more recently than [selected cutoff] are given a higher rank.'
|
|
||||||
)
|
|
||||||
.addDropdown(dropdown =>
|
|
||||||
dropdown
|
|
||||||
.addOptions({
|
|
||||||
[RecencyCutoff.Disabled]: 'Disabled',
|
|
||||||
[RecencyCutoff.Day]: '24 hours',
|
|
||||||
[RecencyCutoff.Week]: '7 days',
|
|
||||||
[RecencyCutoff.Month]: '30 days',
|
|
||||||
})
|
|
||||||
.setValue(settings.recencyBoost)
|
|
||||||
.onChange(async v => {
|
|
||||||
settings.recencyBoost = v as RecencyCutoff
|
|
||||||
await saveSettings(plugin)
|
|
||||||
})
|
|
||||||
)
|
|
||||||
|
|
||||||
// Downranked files
|
// Downranked files
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('Folders to downrank in search results')
|
.setName('Folders to downrank in search results')
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import { Setting, SliderComponent } from 'obsidian'
|
import { Setting, SliderComponent } from 'obsidian'
|
||||||
import {
|
import { getDefaultSettings } from 'src/settings'
|
||||||
getDefaultSettings,
|
|
||||||
} from 'src/settings'
|
|
||||||
import type { OmnisearchSettings } from './utils'
|
import type { OmnisearchSettings } from './utils'
|
||||||
import { saveSettings } from './utils'
|
import { saveSettings } from './utils'
|
||||||
import type { WeightingSettings } from './utils'
|
import type { WeightingSettings } from './utils'
|
||||||
import type OmnisearchPlugin from 'src/main'
|
import type OmnisearchPlugin from 'src/main'
|
||||||
|
import { RecencyCutoff } from 'src/globals'
|
||||||
|
|
||||||
export function injectSettingsWeighting(
|
export function injectSettingsWeighting(
|
||||||
plugin: OmnisearchPlugin,
|
plugin: OmnisearchPlugin,
|
||||||
@@ -64,18 +63,19 @@ export function injectSettingsWeighting(
|
|||||||
|
|
||||||
for (let i = 0; i < settings.weightCustomProperties.length; i++) {
|
for (let i = 0; i < settings.weightCustomProperties.length; i++) {
|
||||||
const item = settings.weightCustomProperties[i]
|
const item = settings.weightCustomProperties[i]
|
||||||
new Setting(containerEl)
|
const el = new Setting(containerEl).setName((i + 1).toString() + '.')
|
||||||
.setName((i + 1).toString() + '.')
|
el.settingEl.style.paddingLeft = '2em'
|
||||||
// TODO: add autocompletion from app.metadataCache.getAllPropertyInfos()
|
|
||||||
.addText(text => {
|
// TODO: add autocompletion from app.metadataCache.getAllPropertyInfos()
|
||||||
text
|
el.addText(text => {
|
||||||
.setPlaceholder('Property name')
|
text
|
||||||
.setValue(item.name)
|
.setPlaceholder('Property name')
|
||||||
.onChange(async v => {
|
.setValue(item.name)
|
||||||
item.name = v
|
.onChange(async v => {
|
||||||
await saveSettings(plugin)
|
item.name = v
|
||||||
})
|
await saveSettings(plugin)
|
||||||
})
|
})
|
||||||
|
})
|
||||||
.addSlider(cb => {
|
.addSlider(cb => {
|
||||||
cb.setLimits(0.1, 5, 0.1)
|
cb.setLimits(0.1, 5, 0.1)
|
||||||
.setValue(item.weight)
|
.setValue(item.weight)
|
||||||
@@ -104,4 +104,24 @@ export function injectSettingsWeighting(
|
|||||||
refreshDisplay()
|
refreshDisplay()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
new Setting(containerEl)
|
||||||
|
.setName('Recency boost (experimental)')
|
||||||
|
.setDesc(
|
||||||
|
'Files that have been modified more recently than [selected cutoff] are given a higher rank.'
|
||||||
|
)
|
||||||
|
.addDropdown(dropdown =>
|
||||||
|
dropdown
|
||||||
|
.addOptions({
|
||||||
|
[RecencyCutoff.Disabled]: 'Disabled',
|
||||||
|
[RecencyCutoff.Day]: '24 hours',
|
||||||
|
[RecencyCutoff.Week]: '7 days',
|
||||||
|
[RecencyCutoff.Month]: '30 days',
|
||||||
|
})
|
||||||
|
.setValue(settings.recencyBoost)
|
||||||
|
.onChange(async v => {
|
||||||
|
settings.recencyBoost = v as RecencyCutoff
|
||||||
|
await saveSettings(plugin)
|
||||||
|
})
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user