Open ysaroka opened 4 years ago
Thank you for reporting, I can reproduce your issue.
Searching is done directly in a in-memory sqlite database.
Seems like that's a limitation there.
Haven't found a way around it yet.
As far as I found out sqlite only supports case insensitive search with ASCII characters.
As far as I found out sqlite only supports case insensitive search with ASCII characters.
Yes it is.
The SQLite API has a sqlite3_create_function():
https://www.sqlite.org/c3ref/create_function.html
Probably, you can override or create a new the LOWER (or LIKE) method to search in UTF-8 case-insensitively:
... UTF8_LOWER(note_text) LIKE ? ...
or
... note_text UTF8_LIKE ? ...
Found the same problem here: https://forum.lazarus.freepascal.org/index.php?topic=34259.0 This is Pascal, but in this case it does not matter.
Another solution is to store additionally "note_text_lowercase" and "file_name_lowercase" fields for the corresponding values in lower case and compare them with the query string reduced to lower case. But i think this is not a good solution)
The SQLite API has a sqlite3_create_function():
I played around with that a bit. The only way to create custom functions in Qt seems to be to depend on (and include) the sqlite source directly. I don't really want to introduce an external dependency to QOwnNotes.
sqlite3.c
has 223k lines of code :laughing:
I don't really want to introduce an external dependency to QOwnNotes.
I agree, bad idea. Sorry, I thought that Qt SQLite driver has a native ability to define custom functions.
Sorry, I thought that Qt SQLite driver has a native ability to define custom functions.
It's all abstracted behind QSqlDatabase
I second that. Are there viable approaches to solving this problem?
Not that I found out any...
sqlite only supports case insensitive search
Here's a relatively fresh article "5 ways to implement case-insensitive search in SQLite with full Unicode support": https://dev.to/shallowdepth/5-ways-to-implement-case-insensitive-search-in-sqlite-with-full-unicode-support-53p2
could this help?
We would need to find something that works with Qt5...
Expected behaviour
Cyrillic words must be searched in the same mode as Latin, in case-insensitive mode.
Actual behaviour
Cyrillic words are searched only in case-sensitive mode, while Latin words are searched case-insensitively (this is correct behavior)
I did not find the ability to configure the search engine in any way. This is probably a issue.
Steps to reproduce
Video (Tested words: "установка", "усТанОвка"): https://www.youtube.com/watch?v=jP_tyzJ1pkc
Information about the application, settings and environment
Expand
QOwnNotes Debug Information =========================== ## General Info **Current Date**: `Чт янв 16 06:03:01 2020` **Version**: `20.1.9` **Build date**: `Jan 15 2020` **Build number**: `5275` **Platform**: `windows` **Operating System**: `Windows 10 (10.0)` **Build architecture**: `i386` **Current architecture**: `x86_64` **Release**: `AppVeyor` **Qt Version (build)**: `5.13.2` **Qt Version (runtime)**: `5.13.2` **Portable mode**: `yes` **Settings path / key**: `D:/apps/qownnotes/Data/PBE/QOwnNotes.ini` **Application database path**: `D:\apps\qownnotes\Data\QOwnNotes.sqlite` **Application arguments**: `D:\apps\qownnotes\QOwnNotes.exe`, `--portable` **Qt Debug**: `0` **Locale (system)**: `ru_RU` **Locale (interface)**: `en` **Primary screen resolution**: `1366x768` **Icon theme**: `breeze-qownnotes` **Notes in current note folder**: `2` **Calendar items**: `0` **Enabled scripts**: `0` ## Server Info **serverUrl**: *empty* **appIsValid**: `no` **notesPathExists**: *empty* **connectionErrorMessage**: *empty* ## Spellchecking **Enabled**: `false` **Selected language**: *empty* **Language codes**: *empty* **Language names**: *empty* **Application dictionaries path**: `D:\apps\qownnotes\Data\dicts` ## Note folders **currentNoteFolderId**: `1` ### Note folder `по умолчанию` **id**: `1` **isCurrent**: `yes` **activeTagId**: `0` **localPath**: `D:\apps\qownnotes\Data\..\..\..\Dropbox\docs\!notes\qownnotes-notes` **remotePath**: `Notes` **cloudConnectionId**: `1` **isShowSubfolders**: `yes` **isUseGit**: `no` **activeNoteSubFolder name**: `Temp` **database file**: `D:\apps\qownnotes\Data\..\..\..\Dropbox\docs\!notes\qownnotes-notes\notes.sqlite` ## Cloud connections ### Cloud connection `По умолчанию` **id**: `1` **isCurrent**: `yes` **serverUrl**: *empty* **username**: *empty* ## Enabled scripts ## Settings **AboutDialog/geometry** (QByteArray): `