Commit graph

7 commits

Author SHA1 Message Date
Berthold Stoeger
04b6bb8cc9 filter: include tags in fulltext search
The tags have been forgotten when implementing the fulltext search.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-16 12:40:08 -07:00
Berthold Stoeger
8b93d67106 mobile: remove fine-grained notification
When initializing the fulltext-cache and the dive-list, every
100 dives a notification was shown. I had a feeling that this
made startup significantly slower, but that could have been
purely psychological.

Therefore I measured and indeed, removing the fine-grained
notification, it becomes *significantly* faster. For a 3500
dives test log with mobile-on-desktop:

Initialization of the fulltext: 1350 ms -> 730 ms (-46%)
Initialization of the divelistmodel: 689 ms -> 113 ms (-83%)

Let's remove the fine-grained notification. There *is* a visual
indication of work-in-progress anyway.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-13 08:30:51 -07:00
Berthold Stoeger
3a74f65063 fulltext: don't call words.clear() in FullText::populate()
This function was not meant to be called with already existing data.
However, if it was, it cleared the words without clearing the fulltext
caches of the dives. This lead to crashes.

Be more resilient by not clearing the words: Already existing dives
are unregistered during the process of populating anyway. So this
now *should* work if new dives are added to the dive list and then
this function is called.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-08 08:08:19 -07:00
Berthold Stoeger
d9599589c7 fulltext: rename fulltext_reload() to fulltext_populate()
This function was named improperly: it was only used on freshly
loaded data. Indeed, attempts to use it to actually reload lead
to crashes.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-08 08:08:19 -07:00
Dirk Hohndel
3df0cf6196 core/fulltext: give progress update while populating index
Especially with large dive logs this will prevent the user from thinking
that the app is hung.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04 12:00:25 -07:00
Berthold Stoeger
5bbc0fdb58 filter: compile fulltext index on mobile
The code is not used yet.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
Berthold Stoeger
6434ad2628 filter: add fulltext filtering code
Add code that indexes all words of a dive and provides searching
for words.

A query is represented by the FullTextQuery class, which can be
initialized by assigning a string to it. It is basically a list
of words.

The result of a search is stored in the FullTextResult class,
which is a list of dives.

The actual indexing and searching is implemented in the FullText
class. However, this class is not exported because the interface
is partially accessible to C. Notably, the reloading of the
fulltext index is done from the C core.

Currently, the indexing and searching is totally unoptimized.
In a ~4000 dives test-log searches typically took single-digit
ms times. There is ample room for optimization (e.g. when
searching for multiple words, chose the words with few dives
first and when down to a few dives, check them individually).

The words of each dive are tokenized and uppercased and
cached with the dive. A pointer to these words is stashed
in the dive structure.

For now, compile only on desktop.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00