#196 - Added customizable weighting for note's directory

This commit is contained in:
Simon Cambier
2023-02-24 10:56:24 +01:00
parent 4f21377aed
commit 4df09aa70c
2 changed files with 10 additions and 3 deletions

View File

@@ -32,7 +32,7 @@ export class Omnisearch {
public static readonly options: Options<IndexedDocument> = {
tokenize,
extractField: (doc, fieldName) => {
if (fieldName === 'folder') {
if (fieldName === 'directory') {
// return path without the filename
const parts = doc.path.split('/')
parts.pop()
@@ -46,7 +46,7 @@ export class Omnisearch {
fields: [
'basename',
// Different from `path`, since `path` is the unique index and needs to include the filename
'folder',
'directory',
'aliases',
'content',
'headings1',
@@ -179,6 +179,7 @@ export class Omnisearch {
combineWith: 'AND',
boost: {
basename: settings.weightBasename,
directory: settings.weightDirectory,
aliases: settings.weightBasename,
headings1: settings.weightH1,
headings2: settings.weightH2,