Fossil SCM

In the fts-config command and on the /srchsetup page, show how much space is used by the full-text index.

drh 2023-07-10 12:50 trunk
Commit 5c5e54928ed382e940e9a2b03076c8805358c69d2fbaa289843ee8cb19af38ef
2 files changed +9 +9 -1
--- src/search.c
+++ src/search.c
@@ -2083,13 +2083,22 @@
20832083
db_get_boolean(aSetng[i].zSetting,0) ? "on" : "off");
20842084
}
20852085
fossil_print("%-17s %s\n", "tokenizer:",
20862086
search_tokenizer_for_string(0));
20872087
if( search_index_exists() ){
2088
+ int pgsz = db_int64(0, "PRAGMA repository.page_size;");
2089
+ i64 nTotal = db_int64(0, "PRAGMA repository.page_count;")*pgsz;
2090
+ i64 nFts = db_int64(0, "SELECT count(*) FROM dbstat"
2091
+ " WHERE schema='repository'"
2092
+ " AND name LIKE 'fts%%'")*pgsz;
2093
+ char zSize[50];
20882094
fossil_print("%-17s FTS%d\n", "full-text index:", search_index_type(1));
20892095
fossil_print("%-17s %d\n", "documents:",
20902096
db_int(0, "SELECT count(*) FROM ftsdocs"));
2097
+ approxSizeName(sizeof(zSize), zSize, nFts);
2098
+ fossil_print("%-17s %s (%.1f%% of repository)\n", "space used",
2099
+ zSize, 100.0*((double)nFts/(double)nTotal));
20912100
}else{
20922101
fossil_print("%-17s disabled\n", "full-text index:");
20932102
}
20942103
db_end_transaction(0);
20952104
}
20962105
--- src/search.c
+++ src/search.c
@@ -2083,13 +2083,22 @@
2083 db_get_boolean(aSetng[i].zSetting,0) ? "on" : "off");
2084 }
2085 fossil_print("%-17s %s\n", "tokenizer:",
2086 search_tokenizer_for_string(0));
2087 if( search_index_exists() ){
 
 
 
 
 
 
2088 fossil_print("%-17s FTS%d\n", "full-text index:", search_index_type(1));
2089 fossil_print("%-17s %d\n", "documents:",
2090 db_int(0, "SELECT count(*) FROM ftsdocs"));
 
 
 
2091 }else{
2092 fossil_print("%-17s disabled\n", "full-text index:");
2093 }
2094 db_end_transaction(0);
2095 }
2096
--- src/search.c
+++ src/search.c
@@ -2083,13 +2083,22 @@
2083 db_get_boolean(aSetng[i].zSetting,0) ? "on" : "off");
2084 }
2085 fossil_print("%-17s %s\n", "tokenizer:",
2086 search_tokenizer_for_string(0));
2087 if( search_index_exists() ){
2088 int pgsz = db_int64(0, "PRAGMA repository.page_size;");
2089 i64 nTotal = db_int64(0, "PRAGMA repository.page_count;")*pgsz;
2090 i64 nFts = db_int64(0, "SELECT count(*) FROM dbstat"
2091 " WHERE schema='repository'"
2092 " AND name LIKE 'fts%%'")*pgsz;
2093 char zSize[50];
2094 fossil_print("%-17s FTS%d\n", "full-text index:", search_index_type(1));
2095 fossil_print("%-17s %d\n", "documents:",
2096 db_int(0, "SELECT count(*) FROM ftsdocs"));
2097 approxSizeName(sizeof(zSize), zSize, nFts);
2098 fossil_print("%-17s %s (%.1f%% of repository)\n", "space used",
2099 zSize, 100.0*((double)nFts/(double)nTotal));
2100 }else{
2101 fossil_print("%-17s disabled\n", "full-text index:");
2102 }
2103 db_end_transaction(0);
2104 }
2105
+9 -1
--- src/setup.c
+++ src/setup.c
@@ -2088,13 +2088,21 @@
20882088
search_create_index();
20892089
search_fill_index();
20902090
search_update_index(search_restrict(SRCH_ALL));
20912091
}
20922092
if( search_index_exists() ){
2093
+ int pgsz = db_int64(0, "PRAGMA repository.page_size;");
2094
+ i64 nTotal = db_int64(0, "PRAGMA repository.page_count;")*pgsz;
2095
+ i64 nFts = db_int64(0, "SELECT count(*) FROM dbstat"
2096
+ " WHERE schema='repository'"
2097
+ " AND name LIKE 'fts%%'")*pgsz;
2098
+ char zSize[30];
2099
+ approxSizeName(sizeof(zSize),zSize,nFts);
20932100
@ <p>Currently using an SQLite FTS%d(search_index_type(0)) search index.
20942101
@ The index helps search run faster, especially on large repositories,
2095
- @ but takes up space.</p>
2102
+ @ but takes up space. The index is currently using about %s(zSize)
2103
+ @ or %.1f(100.0*(double)nFts/(double)nTotal)%% of the repository.</p>
20962104
select_fts_tokenizer();
20972105
@ <p><input type="submit" name="fts0" value="Delete The Full-Text Index">
20982106
@ <input type="submit" name="fts1" value="Rebuild The Full-Text Index">
20992107
style_submenu_element("FTS Index Debugging","%R/test-ftsdocs");
21002108
}else{
21012109
--- src/setup.c
+++ src/setup.c
@@ -2088,13 +2088,21 @@
2088 search_create_index();
2089 search_fill_index();
2090 search_update_index(search_restrict(SRCH_ALL));
2091 }
2092 if( search_index_exists() ){
 
 
 
 
 
 
 
2093 @ <p>Currently using an SQLite FTS%d(search_index_type(0)) search index.
2094 @ The index helps search run faster, especially on large repositories,
2095 @ but takes up space.</p>
 
2096 select_fts_tokenizer();
2097 @ <p><input type="submit" name="fts0" value="Delete The Full-Text Index">
2098 @ <input type="submit" name="fts1" value="Rebuild The Full-Text Index">
2099 style_submenu_element("FTS Index Debugging","%R/test-ftsdocs");
2100 }else{
2101
--- src/setup.c
+++ src/setup.c
@@ -2088,13 +2088,21 @@
2088 search_create_index();
2089 search_fill_index();
2090 search_update_index(search_restrict(SRCH_ALL));
2091 }
2092 if( search_index_exists() ){
2093 int pgsz = db_int64(0, "PRAGMA repository.page_size;");
2094 i64 nTotal = db_int64(0, "PRAGMA repository.page_count;")*pgsz;
2095 i64 nFts = db_int64(0, "SELECT count(*) FROM dbstat"
2096 " WHERE schema='repository'"
2097 " AND name LIKE 'fts%%'")*pgsz;
2098 char zSize[30];
2099 approxSizeName(sizeof(zSize),zSize,nFts);
2100 @ <p>Currently using an SQLite FTS%d(search_index_type(0)) search index.
2101 @ The index helps search run faster, especially on large repositories,
2102 @ but takes up space. The index is currently using about %s(zSize)
2103 @ or %.1f(100.0*(double)nFts/(double)nTotal)%% of the repository.</p>
2104 select_fts_tokenizer();
2105 @ <p><input type="submit" name="fts0" value="Delete The Full-Text Index">
2106 @ <input type="submit" name="fts1" value="Rebuild The Full-Text Index">
2107 style_submenu_element("FTS Index Debugging","%R/test-ftsdocs");
2108 }else{
2109

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button