Commit Graph

832 Commits

Author SHA1 Message Date
Bao
1c98d8b2d7 Fix uncaught exceptions (#414)
* Fix handling of folders on create trigger

When creating a directory in the vault, omnisearch attempts to index the directory as a document

`on('create', (file) => any, ...)` is triggered for both files and directories, so any triggers on `create` should handle the case where `file` is a `TFolder`.[^1]

[^1]: https://docs.obsidian.md/Reference/TypeScript+API/Vault/on('create')

For example, after running `mkdir foobar` in the vault directory, the
following exception is thrown:

```stacktrace
documents-repository.ts:53 Omnisearch: Error while adding "foobar" to live cache Error: Not a TFile: "foobar"
    at DocumentsRepository.getAndMapIndexedDocument (documents-repository.ts:85:41)
    at DocumentsRepository.addDocument (documents-repository.ts:43:30)
    at DocumentsRepository.getDocument (documents-repository.ts:69:16)
    at eval (search-engine.ts:82:63)
    at Array.map (<anonymous>)
    at SearchEngine.addFromPaths (search-engine.ts:81:15)
    at eval (main.ts:114:26)
    at e.tryTrigger (app.js:1:723011)
    at e.trigger (app.js:1:722944)
    at t.trigger (app.js:1:741049)
```

* Fix handling of empty canvas files

Canvas files can be empty. e.g. when the "Create new canvas" command is called:

- immediately after the command:
  - a new *empty* .canvas file will be created
  - triggering the `create` event and causing a "Unexpected end of JSON input" error
- when saving the file (<cmd/ctrl>+s or "Save current file" command):
  - `{}` will be written to the file
  - triggering a file `modify` event and causing a "canvas.nodes is not iterable" exception

Examples of the exceptions:

```stacktrace
documents-repository.ts:53 Omnisearch: Error while adding "Untitled.canvas" to live cache SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at DocumentsRepository.getAndMapIndexedDocument (documents-repository.ts:100:27)
    at async DocumentsRepository.addDocument (documents-repository.ts:43:19)
    at async DocumentsRepository.getDocument (documents-repository.ts:69:5)
    at async eval (search-engine.ts:82:25)
    at async Promise.all (index 0)
    at async SearchEngine.addFromPaths (search-engine.ts:80:7)
```

```stacktrace
documents-repository.ts:53 Omnisearch: Error while adding "Untitled.canvas" to live cache TypeError: canvas.nodes is not iterable
    at DocumentsRepository.getAndMapIndexedDocument (documents-repository.ts:103:33)
    at async DocumentsRepository.addDocument (documents-repository.ts:43:19)
    at async NotesIndexer.refreshIndex (notes-indexer.ts:29:7)
```
2024-11-05 18:40:58 +01:00
Simon Cambier
01a9e976e6 1.25.0 2024-10-26 11:15:08 +02:00
Simon Cambier
efd99b67a0 small fixes 2024-10-26 11:07:21 +02:00
Simon Cambier
ec82bd29fa Merge branch 'develop'
# Conflicts:
#	manifest-beta.json
#	versions.json
2024-10-26 11:04:33 +02:00
Simon Cambier
45693aac0d Update bug_report.md 2024-10-19 09:43:17 +02:00
Simon Cambier
be61942c84 1.25.0-beta.4 manifest 2024-10-13 19:06:04 +02:00
Simon Cambier
8e5e143d45 1.25.0-beta.4 2024-10-13 18:48:25 +02:00
Simon Cambier
7d7902ec9d Warn when too many errors in a short time 2024-10-13 18:44:22 +02:00
Simon Cambier
fc19f96dfd Renamed CacheManager to DocumentsRepository 2024-10-13 18:16:25 +02:00
Simon Cambier
4ed3b4d612 Dependencies update 2024-10-13 18:02:24 +02:00
Simon Cambier
e2962ec021 Refactored relevant methods to SearchHistory 2024-10-13 18:01:40 +02:00
Simon Cambier
75914d7a9d Changelog update 2024-10-13 17:30:28 +02:00
Simon Cambier
09455c91f2 1.25.0-beta.3 manifest 2024-10-08 20:52:10 +02:00
Simon Cambier
973b632763 1.25.0-beta.3 2024-10-08 20:51:24 +02:00
Simon Cambier
0c41d48963 escape html for external strings 2024-10-08 20:46:12 +02:00
Simon Cambier
9f0c460161 Fixed css classes names 2024-10-08 20:45:34 +02:00
Simon Cambier
af63186aa2 CONTRIBUTING update 2024-10-08 20:39:25 +02:00
acrylicus
e9faa24369 Added support for Iconize plugin (#405)
* 1.25.0-beta.1 manifest

* chore: manifest 1.25.0-beta.2

* Added support for Iconize plugin

* Adjusted logic to fallback to generic icon if nothing found & added supported for Lucide Icon

* Added support for Emojis (thanks ChatGPT)

* Added dynamic updating of icons to match search results

* Moved icon logic to tools/iconUtils.ts, cleaned up ResultItemVault.svelte

* Moved icon logic to tools/iconUtils.ts, cleaned up ResultItemVault.svelte

* Prettified code and fixed case where CamelCase lucideicons do not render in search results

* Refactored code to check for Iconize plugin enablement, rehandled errors, minor tidy ups and utilization of native obsidian functions

* Minor touchups and improvements, removed unecessary error logging, consolidated LucideIcon prefix code

* Null return for no iconize condition

---------

Co-authored-by: Simon Cambier <simon.cambier@protonmail.com>
2024-10-08 20:27:01 +02:00
Simon Cambier
a4352c365c Fixed embeds injection in results 2024-10-08 17:13:04 +02:00
Simon Cambier
24ee6675c4 Weights are now ranged 0-10 (instead of 0-5) 2024-10-02 18:21:30 +02:00
Simon Cambier
d82b67dfc1 chore: updated release.yml 2024-09-27 14:01:43 +02:00
Simon Cambier
813eefe95d chore: manifest 1.25.0-beta.2 2024-09-27 13:55:38 +02:00
Simon Cambier
dfedd37407 chore: 1.25.0-beta.2 2024-09-27 13:54:55 +02:00
Simon Cambier
372e40fe74 feat(#245): added a setting to determine how many embeds references to display in results 2024-09-27 13:53:57 +02:00
Simon Cambier
983fa2120b fix(#245): correctly update embeds on fs events 2024-09-27 13:53:30 +02:00
Simon Cambier
10721601b1 ffs typescript. 2024-09-25 20:52:02 +02:00
Simon Cambier
532c232d75 1.25.0-beta.1 manifest 2024-09-25 20:49:51 +02:00
Simon Cambier
5dec98df7c 1.25.0-beta.1 2024-09-25 20:49:03 +02:00
Simon Cambier
1b442d1f24 feat(#245): in results list, show where an image/pdf is embedded
* Add an index of embeds for reference in results

* Notes embedding images are now shown in results

* Updated dependencies

* Correctly referencing all embeds

* Updated docs

* Basic embedded feature ok
2024-09-25 20:47:27 +02:00
Simon Cambier
437b7e2b9a Merge branch 'master' into develop 2024-09-25 20:44:06 +02:00
Simon Cambier
43dd1f469e chore: deps update and fixed some import paths 2024-09-15 16:39:20 +02:00
Simon Cambier
6bcf4087b6 Update README.md 2024-09-08 12:41:31 +02:00
Simon Cambier
a675a8c57d Update README.md 2024-09-08 12:40:15 +02:00
Simon Cambier
570cbb94c3 fix(workflows): removed explicit pnpm version 2024-08-13 19:12:09 +02:00
Simon Cambier
5c294db9f3 chore: 1.24.1 2024-08-13 19:06:59 +02:00
Simon Cambier
490c2811ab Merge branch 'master' of github.com:scambier/obsidian-omnisearch 2024-08-13 19:06:31 +02:00
Simon Cambier
34e7f378da fix: on mobile, added a delay before showing the keyboard #345 2024-08-13 18:55:08 +02:00
Swaggeroo
e9869758b5 Bug fix / Refactor Added Ai Image Analyzer Text again and removed unnecessary var indexingDesc (#388) 2024-08-13 18:32:30 +02:00
Simon Cambier
1ccfe23d7a 1.24.0 2024-07-31 14:13:36 +02:00
Simon Cambier
ae39d3d2bb Merge branch 'develop' 2024-07-31 11:18:30 +02:00
Simon Cambier
439150a1f0 fix: tentative workaround for #383 2024-07-31 11:17:35 +02:00
Simon Cambier
c34503f1cd 1.24.0-beta.3 manifest 2024-07-23 09:59:32 +02:00
Simon Cambier
a778937292 1.24.0-beta.3 2024-07-23 09:58:10 +02:00
Simon Cambier
5bc393e3ca Merge branch 'master' into develop
# Conflicts:
#	src/settings.ts
2024-07-23 09:56:31 +02:00
Swaggeroo
58cc6400e8 Added Ai Image Analyzer support (#386)
* Added Ai Image Analyzer support

* removed unnecessary null check
2024-07-23 09:51:43 +02:00
A. Zhang
26867000dd Update README.md for using Chinese split plugin (#385) 2024-07-14 08:45:40 +02:00
Simon Cambier
6e62df2c36 release.yml 2024-06-29 21:21:17 +02:00
Simon Cambier
e79ffe873a release.yml 2024-06-29 21:16:11 +02:00
Simon Cambier
3ad15ea847 Removed useless field 2024-06-29 20:36:12 +02:00
Simon Cambier
159542ac82 1.24.0-beta.2 manifest 2024-06-29 20:33:43 +02:00