From 6434ad262887a473abd410fd8011bba1291663d6 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 16 Feb 2020 22:19:44 +0100 Subject: 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 --- core/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'core/CMakeLists.txt') diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 24df1854b..d3f1401f1 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -88,6 +88,8 @@ set(SUBSURFACE_CORE_LIB_SRCS file.h format.cpp format.h + fulltext.cpp + fulltext.h gas.c gas.h gas-model.c -- cgit v1.2.3-70-g09d2