mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
41aae1aebe
commit
6434ad2628
4 changed files with 365 additions and 0 deletions
|
|
@ -170,6 +170,9 @@ struct dive {
|
|||
bool notrip; /* Don't autogroup this dive to a trip */
|
||||
bool selected;
|
||||
bool hidden_by_filter;
|
||||
#if !defined(SUBSURFACE_MOBILE)
|
||||
struct full_text_cache *full_text; /* word cache for full text search */
|
||||
#endif
|
||||
#if defined(SUBSURFACE_MOBILE)
|
||||
uint8_t collapsed; /* four values: 0 = don't show, 1 = show as dive, 2 = show corresponding trip, 3 = show dive and trip */
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue