scambier / obsidian-omnisearch

A search engine that "just works" for Obsidian. Supports OCR and PDF indexing.
GNU General Public License v3.0
1.19k stars 60 forks source link

[Feature request] Plugin settings for disabling real-time indexing for large documents #57

Closed shaggyfeng closed 2 years ago

shaggyfeng commented 2 years ago

Is your feature request related to a problem? Please describe.

When typing in a document that has a lot of words (300,000ish), this plugin will cause some lag. I tested it many times to make sure the lag was caused by Omni Search.

Describe the solution you'd like

It would be great to have a plugin option to turn off real-time indexing for documents that have more than a certain number of characters.

Describe alternatives you've considered

Or simply provide an option to only index new words when opening obsidian. That might fix the lag, I guess.

Additional context

Your plugin is the best searching plugin IMO! Thanks

scambier commented 2 years ago

When typing in a document that has a lot of words (300,000ish), this plugin will cause some lag.

Oh boy I'm sure it does. Is the lag longer than 1-2 seconds?

If not, what about an option to re-index edited documents when Obisidian is alt-tabbed out? So the indexing is done in the background, and should be done once you're back.

Your plugin is the best searching plugin IMO! Thanks

shaggyfeng commented 2 years ago

Well, whenever I tried to type anything, anywhere within a large document, input would lag for 1 second.

Indexing in the background does sound like a good idea. I guess as long as no indexing happens when writing or editing a large document, we should not have any lagging issues.

Thanks

scambier commented 2 years ago

Fixed and published in 1.3.2-beta (accessible through BRAT)

shaggyfeng commented 2 years ago

Fixed and published in 1.3.2-beta (accessible through BRAT (乳臭未干) )

When I copy text from another APP to Obsidian, the cursor will lag for a few seconds if the MD file has a lot of words (200k) in it. When I turn the omni (v1.3.4) plugin off, there is no lag.

I guess a 15-second delay before the alt-tabbed-out index might fix this issue.

Thanks

scambier commented 2 years ago

@shaggyfeng can you make sure that this setting is unchecked? image

If that's the case, does the lag happen only when you first paste the text (and tab out of obsidian), or every time you write something?

shaggyfeng commented 2 years ago

The lag happens every time I paste the text (tab out of obsidian). When I copy outside of obsidian and paste inside of obsidian, it lags every time.

If I use obsidian side by side with other apps, Omni thinks I am taking a break, but that is not the case. So if you add a delay to the indexing after tab-out of obsidian, it should work just fine. Maybe something like a 15 or 30 seconds delay will be all right.

Thanks

scambier commented 2 years ago

I'll tweak the settings to get something less intrusive.

shaggyfeng commented 2 years ago

I'll tweak the settings to get something less intrusive (侵入) .

Is it a good idea to terminate the indexing if a user tabs back to obsidian and the indexing is still running after, let's say 1000ms? Just a thought. Just ignore me if it is not helpful.

Thanks

scambier commented 2 years ago

Nope sorry. Once a document is starting to get indexed, you can't stop it; it's a synchronous process. You can stop between documents, but I don't think it'd be useful in your use-case, since you're alt-tabbing and copying (I guess) one document at a time.

If the startup indexing time is also a problem for you, the latest beta introduced a feature to save the index on disk and reload it at startup.