Fossil SCM
In the fts-config command and on the /srchsetup page, show how much space is used by the full-text index.
Commit
5c5e54928ed382e940e9a2b03076c8805358c69d2fbaa289843ee8cb19af38ef
Parent
1e1a319e6313f31…
2 files changed
+9
+9
-1
+9
| --- src/search.c | ||
| +++ src/search.c | ||
| @@ -2083,13 +2083,22 @@ | ||
| 2083 | 2083 | db_get_boolean(aSetng[i].zSetting,0) ? "on" : "off"); |
| 2084 | 2084 | } |
| 2085 | 2085 | fossil_print("%-17s %s\n", "tokenizer:", |
| 2086 | 2086 | search_tokenizer_for_string(0)); |
| 2087 | 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]; | |
| 2088 | 2094 | fossil_print("%-17s FTS%d\n", "full-text index:", search_index_type(1)); |
| 2089 | 2095 | fossil_print("%-17s %d\n", "documents:", |
| 2090 | 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)); | |
| 2091 | 2100 | }else{ |
| 2092 | 2101 | fossil_print("%-17s disabled\n", "full-text index:"); |
| 2093 | 2102 | } |
| 2094 | 2103 | db_end_transaction(0); |
| 2095 | 2104 | } |
| 2096 | 2105 |
| --- 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 @@ | ||
| 2088 | 2088 | search_create_index(); |
| 2089 | 2089 | search_fill_index(); |
| 2090 | 2090 | search_update_index(search_restrict(SRCH_ALL)); |
| 2091 | 2091 | } |
| 2092 | 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); | |
| 2093 | 2100 | @ <p>Currently using an SQLite FTS%d(search_index_type(0)) search index. |
| 2094 | 2101 | @ 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> | |
| 2096 | 2104 | select_fts_tokenizer(); |
| 2097 | 2105 | @ <p><input type="submit" name="fts0" value="Delete The Full-Text Index"> |
| 2098 | 2106 | @ <input type="submit" name="fts1" value="Rebuild The Full-Text Index"> |
| 2099 | 2107 | style_submenu_element("FTS Index Debugging","%R/test-ftsdocs"); |
| 2100 | 2108 | }else{ |
| 2101 | 2109 |
| --- 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 |