coolreader icon indicating copy to clipboard operation
coolreader copied to clipboard

Android: fake results in search (no cleanup of database on moving of files around)

Open mcepl opened this issue 4 years ago • 12 comments

Screenshot_20210916-142640

Happens to me all the time: when searching I get some results twice (although the file is in the filesystem only once) and one of the results (first in this case) just returns CoolReader to reading whatever I was reading before. Any ideas?

Using CoolReader from F-Droid.

mcepl avatar Sep 16 '21 17:09 mcepl

CoolReader looks in the database, not the filesystem. Most likely, you have orphan records in your database instance:

  • it was possible to move book files from one folder to another;
  • or earlier there really were 2 copies of the file, then you deleted one, but the record remained in the database;
  • in addition, it is possible that there are indeed several identical files on the device, in a place that you may not even imagine, for example, in the application private directory;
  • more reasons, which I don't even presume...

Perhaps someday we will implement a neat cleaning of the database from such misunderstandings :)

virxkane avatar Sep 16 '21 18:09 virxkane

I would think that “Search for books in the folder” (or how it is called in English, this is my back-translation from Czech) would do the database cleanup, doesn't it?

And yes, I do a lot of moving of EPub files among folders. Mostly I put all new files into tmp/ folder, and when I finish reading it, I move it to some appropriate archiving folder.

mcepl avatar Sep 16 '21 20:09 mcepl

I would think that “Search for books in the folder” (or how it is called in English, this is my back-translation from Czech) would do the database cleanup, doesn't it?

No, it doesn't.

virxkane avatar Sep 17 '21 07:09 virxkane

No, it doesn't.

OK, I'll bite. Why it doesn't?

mcepl avatar Sep 17 '21 08:09 mcepl

OK, I'll bite. Why it doesn't?

Well, because nobody did. I think no one will mind if you implement a neat cleanup of the database and do a PR :)

virxkane avatar Sep 17 '21 09:09 virxkane

Sorry, you don't want me to write a large C code.

mcepl avatar Sep 17 '21 17:09 mcepl

Where is that database stored. I tried to clean up applications storage space and cache, but that isn’t it, right? Fake results are still present.

mcepl avatar Dec 16 '21 11:12 mcepl

@mcepl, it was implemented in my fork, you could investigate from here (search for "maintenance", "orphan"): https://github.com/plotn/coolreader/blob/master/android/src/org/coolreader/crengine/ScanLibraryDialog.java Unfortunally I do not plan to make a PR into upstream, but one could adopt it, if he want.

plotn avatar Mar 08 '22 20:03 plotn

Unfortunally I do not plan to make a PR into upstream, but one could adopt it, if he want.

Why?

mcepl avatar Mar 08 '22 22:03 mcepl

Why?

The codebase became significially different, it is hard manual work. On the other hand - upstream development actually stopped, so this makes no sense, as I guess.

plotn avatar Mar 09 '22 07:03 plotn

The codebase became significially different, it is hard manual work. On the other hand - upstream development actually stopped, so this makes no sense, as I guess.

So, why won’t you publish it as a fork and provide binaries on F-Droid?

mcepl avatar Mar 09 '22 08:03 mcepl

@mcepl , this work in progress. anyway, you could get my binaries if you want from 4pda theme - e.g. https://4pda.to/forum/index.php?s=&showtopic=995536&view=findpost&p=113572389

plotn avatar Mar 09 '22 09:03 plotn