mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
filter: index/unindex dives on loading or clearing logs
When loading dive data, populate the fulltext index. When clearing dive data, free the fulltext index. When deleting a dive, remove it from the fulltext index. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
6434ad2628
commit
d3f6e032cc
3 changed files with 20 additions and 0 deletions
10
core/dive.c
10
core/dive.c
|
@ -17,6 +17,10 @@
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
#include "trip.h"
|
#include "trip.h"
|
||||||
#include "structured_list.h"
|
#include "structured_list.h"
|
||||||
|
#ifndef SUBSURFACE_MOBILE
|
||||||
|
#include "fulltext.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* one could argue about the best place to have this variable -
|
/* one could argue about the best place to have this variable -
|
||||||
* it's used in the UI, but it seems to make the most sense to have it
|
* it's used in the UI, but it seems to make the most sense to have it
|
||||||
|
@ -356,6 +360,9 @@ static void free_dive_structures(struct dive *d)
|
||||||
{
|
{
|
||||||
if (!d)
|
if (!d)
|
||||||
return;
|
return;
|
||||||
|
#ifndef SUBSURFACE_MOBILE
|
||||||
|
fulltext_unregister(d);
|
||||||
|
#endif
|
||||||
/* free the strings */
|
/* free the strings */
|
||||||
free(d->buddy);
|
free(d->buddy);
|
||||||
free(d->divemaster);
|
free(d->divemaster);
|
||||||
|
@ -401,6 +408,9 @@ static void copy_dive_nodc(const struct dive *s, struct dive *d)
|
||||||
*d = *s;
|
*d = *s;
|
||||||
memset(&d->cylinders, 0, sizeof(d->cylinders));
|
memset(&d->cylinders, 0, sizeof(d->cylinders));
|
||||||
memset(&d->weightsystems, 0, sizeof(d->weightsystems));
|
memset(&d->weightsystems, 0, sizeof(d->weightsystems));
|
||||||
|
#ifndef SUBSURFACE_MOBILE
|
||||||
|
d->full_text = NULL;
|
||||||
|
#endif
|
||||||
invalidate_dive_cache(d);
|
invalidate_dive_cache(d);
|
||||||
d->buddy = copy_string(s->buddy);
|
d->buddy = copy_string(s->buddy);
|
||||||
d->divemaster = copy_string(s->divemaster);
|
d->divemaster = copy_string(s->divemaster);
|
||||||
|
|
|
@ -140,6 +140,7 @@ struct dive_site;
|
||||||
struct dive_site_table;
|
struct dive_site_table;
|
||||||
struct dive_trip;
|
struct dive_trip;
|
||||||
struct trip_table;
|
struct trip_table;
|
||||||
|
struct full_text_cache;
|
||||||
struct dive {
|
struct dive {
|
||||||
struct dive_trip *divetrip;
|
struct dive_trip *divetrip;
|
||||||
timestamp_t when;
|
timestamp_t when;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "deco.h"
|
#include "deco.h"
|
||||||
#include "divesite.h"
|
#include "divesite.h"
|
||||||
#include "divelist.h"
|
#include "divelist.h"
|
||||||
|
#include "fulltext.h"
|
||||||
#include "planner.h"
|
#include "planner.h"
|
||||||
#include "qthelper.h"
|
#include "qthelper.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
|
@ -829,6 +830,10 @@ void process_loaded_dives()
|
||||||
|
|
||||||
/* Autogroup dives if desired by user. */
|
/* Autogroup dives if desired by user. */
|
||||||
autogroup_dives(&dive_table, &trip_table);
|
autogroup_dives(&dive_table, &trip_table);
|
||||||
|
|
||||||
|
#ifndef SUBSURFACE_MOBILE
|
||||||
|
fulltext_reload();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1338,6 +1343,10 @@ int get_dive_id_closest_to(timestamp_t when)
|
||||||
|
|
||||||
void clear_dive_file_data()
|
void clear_dive_file_data()
|
||||||
{
|
{
|
||||||
|
#ifndef SUBSURFACE_MOBILE
|
||||||
|
fulltext_unregister_all();
|
||||||
|
#endif
|
||||||
|
|
||||||
while (dive_table.nr)
|
while (dive_table.nr)
|
||||||
delete_single_dive(0);
|
delete_single_dive(0);
|
||||||
current_dive = NULL;
|
current_dive = NULL;
|
||||||
|
|
Loading…
Add table
Reference in a new issue