Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Allow ignore tildes and special characters on search #3128

Open
nico2sh opened this issue Oct 10, 2024 · 5 comments
Open

[FEATURE] Allow ignore tildes and special characters on search #3128

nico2sh opened this issue Oct 10, 2024 · 5 comments
Labels
Severity: Low Bugs or breaking changes with low impact Type: Feature adds functionality

Comments

@nico2sh
Copy link

nico2sh commented Oct 10, 2024

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

It would be great to be able to search ignoring tildes, when I search both in the search box and in a script, I have to type exactly how it was written (ignoring uppercase though), so if I'm looking for something like:

Avion means plane in Spanish

I get zero results if the actual text is

Avión means plane in Spanish

Describe the solution you'd like

In search, use these character mappings for example:

  • á=a
  • é=e
  • í=i
  • ó=o
  • ú=u
  • ñ=n
  • ç=c
    ...more?
@pbek
Copy link
Owner

pbek commented Oct 10, 2024

This looks like a sqlite collate question. I guess someone would need to research and then try how this could be achieved with sqlite and Qt.

@pbek
Copy link
Owner

pbek commented Oct 10, 2024

@pbek
Copy link
Owner

pbek commented Oct 10, 2024

And this is one part of the search function:

QVector<Note> Note::search(const QString &text) {
QSqlDatabase db = QSqlDatabase::database(QStringLiteral("memory"));
QSqlQuery query(db);
QVector<Note> noteList;
query.prepare(
QStringLiteral("SELECT * FROM note WHERE note_text LIKE :text "
"ORDER BY file_last_modified DESC"));
query.bindValue(QStringLiteral(":text"), QStringLiteral("%") + text + QStringLiteral("%"));
if (!query.exec()) {
qWarning() << __func__ << ": " << query.lastError();
} else {
for (int r = 0; query.next(); r++) {
noteList.append(noteFromQuery(query));
}
}
return noteList;
}

@pbek pbek added Type: Feature adds functionality Severity: Low Bugs or breaking changes with low impact and removed Type: Support labels Oct 10, 2024
@nico2sh
Copy link
Author

nico2sh commented Oct 11, 2024

Thanks for pointing out to the right direction. From the sqlite docs, no case unicode characters search is not supported but the NOCASE collation can be overriden. One can register their own collating sequence.
My C++ is very rusty to figure out if that or how that can be done :/

@pbek
Copy link
Owner

pbek commented Oct 11, 2024

One can register their own collating sequence.

Hm, even if that would work with Qt, I guess that might cause a lot of regressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Severity: Low Bugs or breaking changes with low impact Type: Feature adds functionality
Projects
None yet
Development

No branches or pull requests

2 participants