13 Commits

Author SHA1 Message Date
Matthew Bogner
1c9570575f Support for dnsA/dnsAAAA data added to v2 index 2026-04-02 13:11:58 +00:00
Peter Serwylo
ba87e2e8ba DB Performance fixes focussing on App Details screen.
Added indexes based on slow query logs and associated `EXPLAIN QUERY
PLAN` output.

Note: There are some composite primary keys with `repoId` +
`packageName` + ..., and we still ad an index on `packageName`.
This is because the order matters in composite keys. It might
be possible to restructure the primary key to be `packageName` +
`repoId` + ..., however this requires removing the table and
recreating it which is more complex then just adding an index on
`packageIndex` in addition to the primary key. There is also no
guarantee that things wont slow down when restructuring the primary key,
because there may be some cases where it is important that `repoId` is
first in that index.
2026-03-26 14:38:48 -03:00
Torsten Grote
f81060859d [db] Migration to version 10
adds a couple of fields we wanted for some time:
* isPrimary for mirrors
* repo errors
* app labels for pre-approved installs
2026-01-05 17:24:10 -03:00
Torsten Grote
0f3f2d6f80 [db] improve search
This now also searches in descriptions, author and package names.
The search also considers all languages now and is insensitive to diacritics in most languages.

The AppMetadataFts needed to be re-created for this to work. A migration and a test for this have been added.
2025-11-04 08:50:50 -03:00
Torsten Grote
8a676010ba [db] rename location to countryCode in Mirror 2024-11-07 14:36:12 -03:00
Torsten Grote
1ba3d00b78 [db] Allow AppPrefs.preferredRepoId to be set to a repo that doesn't contain the app 2024-11-07 10:17:58 -03:00
Tobias_Groza
1e7324ca3b Fix case insensitive search containing diacritics by changing FTS4 tokenizer
The default `simple` tokenzier config used in Room/SQLite3 FTS4 makes only ASCII characters case insensitive. The SQLite FTS3/4 doc [1] says:

> All uppercase characters within the ASCII range (Unicode codepoints less than 128), are transformed to their lowercase equivalents as part of the tokenization process. Thus, full-text queries are case-insensitive when using the simple tokenizer.

> The remove_diacritics option may be set to "0", "1" or "2". The default value is "1". If it is set to "1" or "2", then diacritics are removed from Latin script characters as described above. However, if it is set to "1", then diacritics are not removed in the fairly uncommon case where a single unicode codepoint is used to represent a character with more that one diacritic. [...] This is technically a bug, but cannot be fixed without creating backwards compatibility problems. If this option is set to "2", then diacritics are correctly removed from all Latin characters.

This change makes use of the intended behaviour by using the `unicode61` tokenizer with the `diacritics="0"` option to keep the behaviour similar to the current one. This replaces the previously used `simple` tokenizer. A migration is necessary to recreate the AppMetadataFts table to make use of the different tokenizer.

[1] https://www.sqlite.org/fts3.html#tokenizer
2024-09-03 19:06:10 +02:00
Torsten Grote
fb041c4450 [db] Fix bug where disabled repos were considered for preferred repo calculation
If an update was available from a disabled repo with a higher priority, the update from an enabled repo with a lower priority would not be offered as an update (i.e. returned by DbUpdateChecker#getUpdatableApps()).
2024-07-09 16:02:37 +00:00
Torsten Grote
fa65084e60 [db] make repo certs non-null and remove repos without cert
historically, repos were added to the DB without much information and could stay in a broken state until manually removed. If a repo is updating, it should have a cert. So only repos that never did a single index update don't have a cert. Nowadays, this can not happen anymore as we get the repo and its cert before adding it to the DB. So whenever we update a repo, we know its certificate and fingerprint. Thus, this includes a DB migration removing all broken repos and making the certificate for repos in the DB non-null.
2024-05-22 09:58:05 +00:00
Torsten Grote
ead8bd1262 [db] Only consider preferred versions for updates and suggested version 2024-02-20 09:42:39 -03:00
Torsten Grote
704234c9df [db] allow setting a preferred repo per app 2024-02-20 09:42:38 -03:00
Torsten Grote
818767b6c0 Update Room DB schema to match actual schema used 2022-12-15 17:10:08 +00:00
Torsten Grote
f6075848e7 Move libraries into their own folder
and remove sharedTest symlink hack. The shared tests are now a proper gradle module to avoid issues with using the same source files in different modules.
2022-09-12 09:46:15 +00:00