From c89bd49973c3c3afe73306339b83112d8b0e811a Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Tue, 21 Nov 2023 01:21:59 -0800 Subject: [PATCH] Fix ranking search results on Obsidian It's reversed since score of entries is now a distance metric on Khoj server. So lesser distance is better. Previously higher score was better --- src/interface/obsidian/src/search_modal.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interface/obsidian/src/search_modal.ts b/src/interface/obsidian/src/search_modal.ts index e841360e..51870934 100644 --- a/src/interface/obsidian/src/search_modal.ts +++ b/src/interface/obsidian/src/search_modal.ts @@ -106,7 +106,7 @@ export class KhojSearchModal extends SuggestModal { // Combine markdown and PDF results and sort them by score let results = mdData.concat(pdfData) - .sort((a: any, b: any) => b.score - a.score) + .sort((a: any, b: any) => a.score - b.score) .map((result: any) => { return { entry: result.entry, file: result.file } as SearchResult; }) this.query = query;