From 69b08e3982d37d69e2d9ca4d136c73880c325ee2 Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Thu, 2 Mar 2023 21:36:06 +0100 Subject: [PATCH 1/8] 1.12.3 --- manifest-beta.json | 2 +- manifest.json | 2 +- package.json | 2 +- versions.json | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/manifest-beta.json b/manifest-beta.json index ef569ca..fc7fb1c 100644 --- a/manifest-beta.json +++ b/manifest-beta.json @@ -1,7 +1,7 @@ { "id": "omnisearch", "name": "Omnisearch", - "version": "1.12.2", + "version": "1.12.3", "minAppVersion": "1.0.0", "description": "A search engine that just works", "author": "Simon Cambier", diff --git a/manifest.json b/manifest.json index 290aefc..fc598f1 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "omnisearch", "name": "Omnisearch", - "version": "1.12.2", + "version": "1.12.3", "minAppVersion": "1.0.0", "description": "A search engine that just works", "author": "Simon Cambier", diff --git a/package.json b/package.json index 07d033e..e0a58e1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scambier.obsidian-search", - "version": "1.12.2", + "version": "1.12.3", "description": "A search engine for Obsidian", "main": "dist/main.js", "scripts": { diff --git a/versions.json b/versions.json index 31daaf8..7a16e65 100644 --- a/versions.json +++ b/versions.json @@ -99,5 +99,6 @@ "1.12.0": "1.0.0", "1.12.1-beta.1": "1.0.0", "1.12.1": "1.0.0", - "1.12.2": "1.0.0" + "1.12.2": "1.0.0", + "1.12.3": "1.0.0" } \ No newline at end of file From 7c91af13c4cf20f491f74d927a349dad6c44d5b8 Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Thu, 2 Mar 2023 21:42:04 +0100 Subject: [PATCH 2/8] 1.13.0-beta.1 manifest --- manifest-beta.json | 2 +- versions.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/manifest-beta.json b/manifest-beta.json index fc7fb1c..c33581b 100644 --- a/manifest-beta.json +++ b/manifest-beta.json @@ -1,7 +1,7 @@ { "id": "omnisearch", "name": "Omnisearch", - "version": "1.12.3", + "version": "1.13.0-beta.1", "minAppVersion": "1.0.0", "description": "A search engine that just works", "author": "Simon Cambier", diff --git a/versions.json b/versions.json index 7a16e65..1a8dd1f 100644 --- a/versions.json +++ b/versions.json @@ -100,5 +100,6 @@ "1.12.1-beta.1": "1.0.0", "1.12.1": "1.0.0", "1.12.2": "1.0.0", - "1.12.3": "1.0.0" + "1.12.3": "1.0.0", + "1.13.0-beta.1": "1.0.0" } \ No newline at end of file From a01a0996a07fdd52fc597e4f975202e0bff7968b Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Sun, 5 Mar 2023 19:35:20 +0100 Subject: [PATCH 3/8] Update README.md --- README.md | 123 +----------------------------------------------------- 1 file changed, 2 insertions(+), 121 deletions(-) diff --git a/README.md b/README.md index 50d88a5..45dcbf5 100644 --- a/README.md +++ b/README.md @@ -45,128 +45,9 @@ information. You can check the [CHANGELOG](./CHANGELOG.md) for more information on the different versions. -## Usage +## Documentation -Omnisearch can be used within 2 different contexts: - -### Vault Search - -Omnisearch's core feature, accessible with the Command Palette "**_Omnisearch: Vault search_**". This modal searches -through your vault and returns the most relevant notes. That's all you need to _find_ a note. - -If you want to list all the search matches of a single note, you can do so by using `tab` to open the In-File Search. - -### In-File Search - -Also accessible through the Command Palette "**_Omnisearch: In-file search_**". This modal searches through the active -note's content and lists the matching results. Just press enter to automatically scroll to the right place. - -## URL Scheme & Public API - -You can open Omnisearch with the following scheme: `obsidian://omnisearch?query=foo bar` - ----- - -For plugin developers and Dataview users, Omnisearch is also accessible through the global -object `omnisearch` (`window.omnisearch`) - -> This API is an experimental feature, the `ResultNote` interface may change in the future. The `search()` function -> returns at most 50 results. - -```ts -// API: -type OmnisearchApi = { - // Returns a promise that will contain the same results as the Vault modal - search: (query: string) => Promise, - // Refreshes the index - refreshIndex: () => Promise - // Register a callback that will be called when the indexing is done - registerOnIndexed: (callback: () => void) => void, - // Unregister a callback that was previously registered - unregisterOnIndexed: (callback: () => void) => void, -} - -type ResultNoteApi = { - score: number - path: string - basename: string - foundWords: string[] - matches: SearchMatchApi[] - excerpt: string -} - -type SearchMatchApi = { - match: string - offset: number -} -``` - -### Dataview Integration - -You can use the Omnisearch API directly within the [Dataview](https://blacksmithgu.github.io/obsidian-dataview/) plugin. - -~~~js -```dataviewjs -const results = await omnisearch.search('your query') -const arr = dv.array(results).sort(r => r.score, 'desc') -dv.table(['File', 'Score'], arr.map(o => [dv.fileLink(o.path), Math.round(o.score)])) -``` -~~~ - -## CSS Customization - -There are several CSS classes you can use to customize the appearance of Omnisearch. - -```css -.omnisearch-modal -.omnisearch-result -.omnisearch-result__title -.omnisearch-result__counter -.omnisearch-result__body -.omnisearch-highlight -.omnisearch-input-container -.omnisearch-input-field -``` - -See [styles.css](./assets/styles.css) for more information. - -## Issues & Solutions - -**Omnisearch makes Obsidian sluggish/freeze at startup.** - -- While Omnisearch does its best to work smoothly in the background, bigger vaults and files can make Obsidian stutter - during indexing. -- If you have several thousands of files, Obsidian may freeze a few seconds at startup while the Omnisearch cache is - loaded in memory. - -**Omnisearch seems to make Obsidian slower.** - -- Once Obsidian has indexed your files at startup, it doesn't do anything while its modal is closed. Your changes are - not indexed until you open the modal again. If you experience slowdowns while using Obsidian, it's unlikely that - Omnisearch is responsible. -- However, Text Extractor can make Obsidian slower while indexing PDFs and images for the first time. If you don't need - those features, you can disable them in the plugin settings. - -**Omnisearch is slow to index my PDFs and images** - -- The first time Text Extractor reads those files, it can take a long time to extract their text. The results are then - cached for the text startup. - -**Omnisearch gives inconsistent/invalid results, there are errors in the developer console** - -- Restart Obsidian to force a reindex of Omnisearch. -- The cache could be corrupted; you can clear it at the bottom of the settings page, then restart Obsidian. - -**A query should return a result that does not appear.** - -- If applicable, make sure that "*Ignore diacritics*" is enabled. -- If you have modified them, reset weightings to their original values. -- Rewrite your query and avoid numbers and common words. - -**I'm still having an issue** - -You can write your issue [here](https://github.com/scambier/obsidian-omnisearch/issues) with as much details as -possible. +https://publish.obsidian.md/omnisearch/Index ## LICENSE From 31ae0cac61f1c866c6e8b5360b38e7a3c6018a5f Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Sun, 5 Mar 2023 19:42:02 +0100 Subject: [PATCH 4/8] Update README.md --- README.md | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 45dcbf5..87a095e 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,19 @@ Under the hood, it uses the excellent [MiniSearch](https://github.com/lucaong/mi ![](https://raw.githubusercontent.com/scambier/obsidian-omnisearch/master/images/omnisearch.gif) + +## Documentation + +https://publish.obsidian.md/omnisearch/Index + +## Installation + +- Omnisearch is available on [the official Community Plugins repository](https://obsidian.md/plugins?search=Omnisearch). +- Beta releases can be installed through [BRAT](https://github.com/TfTHacker/obsidian42-brat). **Be advised that those + versions can be buggy and break things.** + +You can check the [CHANGELOG](./CHANGELOG.md) for more information on the different versions. + ## Features > Omnisearch's first goal is to _locate_ files instantly. You can see it as a _Quick Switcher_ on steroids. @@ -37,18 +50,6 @@ Under the hood, it uses the excellent [MiniSearch](https://github.com/lucaong/mi on [this additional plugin](https://github.com/aidenlx/cm-chs-patch). Please read its documentation for more information. -## Installation - -- Omnisearch is available on [the official Community Plugins repository](https://obsidian.md/plugins?search=Omnisearch). -- Beta releases can be installed through [BRAT](https://github.com/TfTHacker/obsidian42-brat). **Be advised that those - versions can be buggy and break things.** - -You can check the [CHANGELOG](./CHANGELOG.md) for more information on the different versions. - -## Documentation - -https://publish.obsidian.md/omnisearch/Index - ## LICENSE Omnisearch is licensed under [GPL-3](https://tldrlegal.com/license/gnu-general-public-license-v3-(gpl-3)). From c4cf6a70bfd243508624929d458f8ee19433d307 Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Thu, 9 Mar 2023 19:30:36 +0100 Subject: [PATCH 5/8] =?UTF-8?q?#205=20-=20Replaced=20=E2=86=B9=20symbol=20?= =?UTF-8?q?with=20tab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ModalInFile.svelte | 2 +- src/components/ModalVault.svelte | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ModalInFile.svelte b/src/components/ModalInFile.svelte index 40bec1b..8079472 100644 --- a/src/components/ModalInFile.svelte +++ b/src/components/ModalInFile.svelte @@ -174,7 +174,7 @@ to open
- + tab to switch to Vault Search
diff --git a/src/components/ModalVault.svelte b/src/components/ModalVault.svelte index 5ff314d..9772cf2 100644 --- a/src/components/ModalVault.svelte +++ b/src/components/ModalVault.svelte @@ -315,7 +315,7 @@ to open
- + tab to switch to In-File Search
From e611202da2c7f84dfa216f78c0e6c2e35db1d9e2 Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Thu, 9 Mar 2023 21:29:09 +0100 Subject: [PATCH 6/8] #206 - Added ctrl+enter shortcut for InFile results --- src/components/ModalInFile.svelte | 20 ++++++++++++++------ src/components/ModalVault.svelte | 4 ---- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/components/ModalInFile.svelte b/src/components/ModalInFile.svelte index 8079472..02c9ba6 100644 --- a/src/components/ModalInFile.svelte +++ b/src/components/ModalInFile.svelte @@ -6,7 +6,7 @@ type ResultNote, type SearchMatch, } from 'src/globals' - import { loopIndex } from 'src/tools/utils' + import { getCtrlKeyLabel, loopIndex } from 'src/tools/utils' import { onDestroy, onMount, tick } from 'svelte' import { MarkdownView } from 'obsidian' import ModalContainer from './ModalContainer.svelte' @@ -36,6 +36,7 @@ eventBus.enable('infile') eventBus.on('infile', 'enter', openSelection) + eventBus.on('infile', 'open-in-new-pane', openSelectionInNewTab) eventBus.on('infile', 'arrow-up', () => moveIndex(-1)) eventBus.on('infile', 'arrow-down', () => moveIndex(1)) eventBus.on('infile', 'tab', switchToVaultModal) @@ -108,15 +109,17 @@ elem?.scrollIntoView({ behavior: 'auto', block: 'nearest' }) } - async function openSelection( - evt?: MouseEvent | KeyboardEvent - ): Promise { + async function openSelectionInNewTab(): Promise { + return openSelection(true) + } + + async function openSelection(newTab = false): Promise { if (note) { modal.close() if (parent) parent.close() // Open (or switch focus to) the note - await openNote(note, evt?.ctrlKey) + await openNote(note, newTab) // Move cursor to the match const view = app.workspace.getActiveViewOfType(MarkdownView) @@ -157,7 +160,7 @@ index="{i}" selected="{i === selectedIndex}" on:mousemove="{_e => (selectedIndex = i)}" - on:click="{openSelection}" /> + on:click="{(evt) => openSelection(evt.ctrlKey)}" /> {/each} {:else}
@@ -185,4 +188,9 @@ to close {/if}
+ +
+ {getCtrlKeyLabel()} ↵ + to open in a new pane +
diff --git a/src/components/ModalVault.svelte b/src/components/ModalVault.svelte index 9772cf2..8deab51 100644 --- a/src/components/ModalVault.svelte +++ b/src/components/ModalVault.svelte @@ -319,8 +319,6 @@ to switch to In-File Search -
-
{getCtrlKeyLabel()} ↵ to open in a new pane @@ -334,8 +332,6 @@ to create in a new pane
-
-
alt ↵ to insert a link From fc8c0763f09a8c7032a9b06b8f8be53f05988b4c Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Thu, 9 Mar 2023 21:40:12 +0100 Subject: [PATCH 7/8] #206 - Added middle click support to open in a new tab --- src/components/ModalInFile.svelte | 5 ++++- src/components/ModalVault.svelte | 5 ++++- src/components/ResultItemInFile.svelte | 3 ++- src/components/ResultItemVault.svelte | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/ModalInFile.svelte b/src/components/ModalInFile.svelte index 02c9ba6..9f0e2a0 100644 --- a/src/components/ModalInFile.svelte +++ b/src/components/ModalInFile.svelte @@ -160,7 +160,10 @@ index="{i}" selected="{i === selectedIndex}" on:mousemove="{_e => (selectedIndex = i)}" - on:click="{(evt) => openSelection(evt.ctrlKey)}" /> + on:click="{evt => openSelection(evt.ctrlKey)}" + on:auxclick="{evt => { + if (evt.button == 1) openSelection(true) + }}" /> {/each} {:else}
diff --git a/src/components/ModalVault.svelte b/src/components/ModalVault.svelte index 8deab51..3956e13 100644 --- a/src/components/ModalVault.svelte +++ b/src/components/ModalVault.svelte @@ -283,7 +283,10 @@ selected="{i === selectedIndex}" note="{result}" on:mousemove="{_ => (selectedIndex = i)}" - on:click="{onClick}" /> + on:click="{onClick}" + on:auxclick="{evt => { + if (evt.button == 1) openNoteInNewPane() + }}" /> {/each}
{#if !resultNotes.length && searchQuery && !searching} diff --git a/src/components/ResultItemInFile.svelte b/src/components/ResultItemInFile.svelte index 3dcba2e..27a5805 100644 --- a/src/components/ResultItemInFile.svelte +++ b/src/components/ResultItemInFile.svelte @@ -20,7 +20,8 @@ id="{index.toString()}" selected="{selected}" on:mousemove - on:click> + on:click + on:auxclick>
{@html cleanedContent.replace(reg, highlighterGroups)}
diff --git a/src/components/ResultItemVault.svelte b/src/components/ResultItemVault.svelte index 13a287b..7cf310e 100644 --- a/src/components/ResultItemVault.svelte +++ b/src/components/ResultItemVault.svelte @@ -63,6 +63,7 @@ glyph="{glyph}" id="{note.path}" on:click + on:auxclick on:mousemove selected="{selected}">
From bb8fd10d1bf00fd03b3682f56e7de1dd0f1c6987 Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Sat, 11 Mar 2023 14:44:56 +0100 Subject: [PATCH 8/8] 1.13.0-beta.2 manifest --- manifest-beta.json | 2 +- versions.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/manifest-beta.json b/manifest-beta.json index c33581b..022ca15 100644 --- a/manifest-beta.json +++ b/manifest-beta.json @@ -1,7 +1,7 @@ { "id": "omnisearch", "name": "Omnisearch", - "version": "1.13.0-beta.1", + "version": "1.13.0-beta.2", "minAppVersion": "1.0.0", "description": "A search engine that just works", "author": "Simon Cambier", diff --git a/versions.json b/versions.json index 1a8dd1f..2d23459 100644 --- a/versions.json +++ b/versions.json @@ -101,5 +101,6 @@ "1.12.1": "1.0.0", "1.12.2": "1.0.0", "1.12.3": "1.0.0", - "1.13.0-beta.1": "1.0.0" + "1.13.0-beta.1": "1.0.0", + "1.13.0-beta.2": "1.0.0" } \ No newline at end of file