summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
Diffstat (limited to 'sources')
-rw-r--r--sources/master/frequent_tags.sql30
-rwxr-xr-xsources/master/update.sh2
2 files changed, 32 insertions, 0 deletions
diff --git a/sources/master/frequent_tags.sql b/sources/master/frequent_tags.sql
new file mode 100644
index 0000000..87b6a46
--- /dev/null
+++ b/sources/master/frequent_tags.sql
@@ -0,0 +1,30 @@
+-- ============================================================================
+--
+-- Taginfo
+--
+-- frequent_tags.sql
+--
+-- ============================================================================
+
+.bail ON
+
+ATTACH DATABASE '__DIR__/db/taginfo-db.db' AS db;
+
+-- ============================================================================
+
+DROP TABLE IF EXISTS frequent_tags;
+CREATE TABLE frequent_tags (
+ key TEXT,
+ value TEXT
+);
+
+-- MIN_COUNT_FOR_MAP setting: sources.master.min_count_for_map
+INSERT INTO frequent_tags (key, value) SELECT key, value FROM db.tags WHERE count_all > __MIN_COUNT_FOR_MAP__;
+
+ANALYZE frequent_tags;
+
+.output __DIR__/db/frequent_tags.lst
+
+SELECT key || '=' || value FROM frequent_tags ORDER BY key, value;
+
+-- ============================================================================
diff --git a/sources/master/update.sh b/sources/master/update.sh
index 872849b..b4e80d0 100755
--- a/sources/master/update.sh
+++ b/sources/master/update.sh
@@ -36,10 +36,12 @@ rm -f $DATABASE
echo "`$DATECMD` Create master database..."
min_count_tags=`../../bin/taginfo-config.rb sources.master.min_count_tags 10000`
+min_count_for_map=`../../bin/taginfo-config.rb sources.master.min_count_for_map 1000`
min_count_relations_per_type=`../../bin/taginfo-config.rb sources.master.min_count_relations_per_type 100`
sqlite3 $DATABASE <languages.sql
$EXEC_RUBY -pe "\$_.sub!(/__DIR__/, '$DIR')" master.sql | sqlite3 $DATABASE
$EXEC_RUBY -pe "\$_.sub!(/__DIR__/, '$DIR')" interesting_tags.sql | $EXEC_RUBY -pe "\$_.sub!(/__MIN_COUNT_TAGS__/, '$min_count_tags')" | sqlite3 $DATABASE
+$EXEC_RUBY -pe "\$_.sub!(/__DIR__/, '$DIR')" frequent_tags.sql | $EXEC_RUBY -pe "\$_.sub!(/__MIN_COUNT_FOR_MAP__/, '$min_count_for_map')" | sqlite3 $DATABASE
$EXEC_RUBY -pe "\$_.sub!(/__DIR__/, '$DIR')" interesting_relation_types.sql | $EXEC_RUBY -pe "\$_.sub!(/__MIN_COUNT_RELATIONS_PER_TYPE__/, '$min_count_relations_per_type')" | sqlite3 $DATABASE
echo "`$DATECMD` Updating history database..."