notes-android icon indicating copy to clipboard operation
notes-android copied to clipboard

Slow search in long notes

Open MiMoHo opened this issue 3 years ago • 2 comments

Please use GitHub reactions 👍 to show that you are affected by the same issue. Please don't comment if you have no relevant information to add!

Describe the bug When searching for a term in a very long note, the app doesn't wait for the user to finish typing but starts searching instantly which results in finding matches for the first letter and then recognizing that the user typed a much longer term and starts searching again.

To Reproduce Steps to reproduce the behavior:

  1. Create a new note, add a novel of text to it and save by going back to the overview.
  2. Reenter the note and type a word in the search bar.
  3. First, the app will only show one letter in the search bar, but you can keep typing on the keyboard. Do so.
  4. The first search iteration will highlight all findings for the first letter of the word and then starts over instantly again for the full word.

Expected behavior There should be a search delay of one second after the user stopped typing before the search is triggered. This will result in cutting down the search time by half in long notes.

Screenshots Search results after the first iteration while the second iteration is running and will produce findings for the entire word soon

Smartphone (please complete the following information):

  • Nextcloud Notes-Version (android app): 4.0.0 RC1
  • F-Droid or Play Store: FDroid
  • Android-Version: 11
  • Device: Sony Xperia

Server

  • Nextcloud version: 26.0.0
  • Nextcloud Notes version (server app): 4.7.2

Stacktrace

MiMoHo avatar Mar 26 '23 14:03 MiMoHo

There should be a search delay of one second after the user stopped typing before the search is triggered. This will result in cutting down the search time by half in long notes.

No, there shouldn't. There already is a delay of 50ms. Waiting for a whole second before starting a simple search in any note for each use case would be terrible.

long notes

Could you please define your long "note"? Are we talking about 100 characters? 1k? 10k? 100k? Maybe you should consider to split your book up into multiple smaller notes?

Or can you contribute a search algorithm which is faster at the same O notation? You can find the currently used algorithm here.

I guess, what actually would help was some kind of Cancel event to stop the current search iteration and start from scratch as soon as a new input parameter arrives.

In any way, this can be considered as "enhancement", but I can't see any bug here :wink:

stefan-niedermann avatar Mar 26 '23 14:03 stefan-niedermann