xiaoyifang / goldendict-ng

The Next Generation GoldenDict
https://xiaoyifang.github.io/goldendict-ng/
Other
1.64k stars 90 forks source link

Doesn't find abbreviated headwords #1185

Open GD-fix opened 1 year ago

GD-fix commented 1 year ago

Describe the bug Doesn't find in Dictionary headwords window the must be abbreviated headwords.

To Reproduce Steps to reproduce the behavior:

  1. Run from console last release, append dictionary with long headwords, copy from output the printed beginning of any skipped headword, quit GD, delete this dictionary indexes and run current pre-release.
  2. Go to 'dictionaries panel'
  3. Click right on the mentioned dictionary
  4. Scroll down to 'Dictionary headwords'
  5. Paste to the Filter string the copied headword beginning
  6. See error

Affected Dictionaries Almost any of https://download.kiwix.org/zim/stack_exchange

Expected behavior Add to Preferences configurable number of "too long headword" characters and remove not working function "Abbreviate the too long headword"

OS and software versions

xiaoyifang commented 1 year ago

give a specific dictionary and a headword plz

GD-fix commented 1 year ago

This one for small example...

xiaoyifang commented 1 year ago

and a headword

xiaoyifang commented 1 year ago

when you paste the headword ,remember to drop the ending '...'

GD-fix commented 1 year ago

I don't understand: when I paste|print in Filter string the beginning of headword (in "Text" Search mode) it's filtered all matching headwords, that beginning from this string. And what is the ending '...' here then?

xiaoyifang commented 1 year ago

This one for small example...

provide a headword ,so I can reproduce the same result .

GD-fix commented 1 year ago

Wait a minute, please. When I had delete dictionary indexes and run current pre-release, things are even worse here: "Zim: Failed building full-text search index for \"3D Printing\", reason: Corrupted chain data in the leaf of a btree encountered\n" (on output). And when I tried to open this dictionary headword window, the pre-release was crushed...

GD-fix commented 1 year ago

...And when I deleted indexes, start last release, quit it after all (including FTS) indexing and start current pre-release without indexes deleting, then everything is according to the previously described (try "Would it be possible to use an" for example or any other from Skipped too long headword output in this case). But this is due of reindexing absent (I think)...

xiaoyifang commented 1 year ago

Wait a minute, please. When I had delete dictionary indexes and run current pre-release, things are even worse here: "Zim: Failed building full-text search index for "3D Printing", reason: Corrupted chain data in the leaf of a btree encountered\n" (on output). And when I tried to open this dictionary headword window, the pre-release was crushed...

this is a bug introduced with 0278597b ("opt: abbreviate the too long headword to maxHeadwordSize (#1137)", 2023-09-10)

xiaoyifang commented 1 year ago

plz try the latest release image

an reindex needed

GD-fix commented 1 year ago

Yes, I had test (after indexes deleting): it works. Thanks, but I ask you to think after all about adding to Preferences configurable number of "too long headword" characters...

To close the theme (non main) with headwords at all, what about Non correct filtered headwords number? For example with mentioned dictionary: after opening Dictionary headwords headwords_1 after using filter headwords_2 In these both cases the total and the filtered numbers of headwords must be equal, I think. You don't agree with me?

xiaoyifang commented 1 year ago

In these both cases the total and the filtered numbers of headwords must be equal, I think. You don't agree with me?

Yes ,I agree.

I'm think about rewrite the whole logic about headword dialog(relate with #1138) , maybe leave the implementation in that time.

xiaoyifang commented 1 year ago

but I ask you to think after all about adding to Preferences configurable number of "too long headword" characters...

I think I'll stick with the default max headword length(which is 100). normally a real headword will not reach the limit. and Wrongly configure this number will lead to performance issue.

GD-fix commented 1 year ago

But it will be the user selection: performance or exactly matching...

GD-fix commented 4 months ago

And what about this small correction with adding to Preferences configurable number of "too long headword" characters?

GD-fix commented 3 weeks ago

In new release it wasn't added...

xiaoyifang commented 3 weeks ago

And what about this small correction with adding to Preferences configurable number of "too long headword" characters?

It is not this simple, the index will be affected when changing the headword length.

GD-fix commented 2 weeks ago

Yes, of course. Who will change it, will get the reindexing. If the default length remains the old one, not changing the parameter must remain the old index.

GD-fix commented 1 week ago

I had receive on e-mail:

[xiaoyifang/goldendict-ng] Doesn't find abbreviated headwords (Issue #1185) author@noreply.github.com

alternative solution. you can change the config settings in the file goldendict/config

image.png (view on web)

I had changed it to 512, start GD-ng and dictionary rescan, but it doesn't matter. I think, it applies to open articles. The headwords are really abbreviated on 87 symbol (see the screenshot) and in this case there isn't any reason to so big number by default (256). But it is a really good length for headword abbreviation... article_abbrev headword