aboutsummaryrefslogtreecommitdiff
path: root/sources/master
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2013-05-27 15:27:26 +0200
committerJochen Topf <jochen@topf.org>2013-05-27 15:27:26 +0200
commit68d4a9caf4c9267976452ad098d29f6522482cc6 (patch)
tree9b01d59a0e12e2edca1cbc1e01008f9b9cb22d2f /sources/master
parentc456c0df0fefd5b8585fce4c12baecbe66b50b34 (diff)
downloadtaginfo-68d4a9caf4c9267976452ad098d29f6522482cc6.tar
taginfo-68d4a9caf4c9267976452ad098d29f6522482cc6.tar.gz
Make minimum number of tags/relations of some type needed for some statistics configurable.
Diffstat (limited to 'sources/master')
-rw-r--r--sources/master/interesting_relation_types.sql3
-rw-r--r--sources/master/interesting_tags.sql5
-rwxr-xr-xsources/master/update.sh6
3 files changed, 9 insertions, 5 deletions
diff --git a/sources/master/interesting_relation_types.sql b/sources/master/interesting_relation_types.sql
index 18aab2d..e2e7954 100644
--- a/sources/master/interesting_relation_types.sql
+++ b/sources/master/interesting_relation_types.sql
@@ -17,8 +17,9 @@ CREATE TABLE interesting_relation_types (
rtype TEXT
);
+-- MIN_COUNT_RELATIONS_PER_TYPE setting: sources.master.min_count_relations_per_type
INSERT INTO interesting_relation_types (rtype)
- SELECT value FROM db.tags WHERE key='type' AND count_relations > 100;
+ SELECT value FROM db.tags WHERE key='type' AND count_relations > __MIN_COUNT_RELATIONS_PER_TYPE__;
ANALYZE interesting_relation_types;
diff --git a/sources/master/interesting_tags.sql b/sources/master/interesting_tags.sql
index 160e1fb..406b525 100644
--- a/sources/master/interesting_tags.sql
+++ b/sources/master/interesting_tags.sql
@@ -21,10 +21,11 @@ CREATE TABLE interesting_tags (
value TEXT
);
+-- MIN_COUNT_TAGS setting: sources.master.min_count_tags
INSERT INTO interesting_tags (key, value)
- SELECT DISTINCT key, NULL FROM db.keys WHERE count_all > 10000
+ SELECT DISTINCT key, NULL FROM db.keys WHERE count_all > __MIN_COUNT_TAGS__
UNION
- SELECT key, value FROM db.tags WHERE count_all > 10000;
+ SELECT key, value FROM db.tags WHERE count_all > __MIN_COUNT_TAGS__;
DELETE FROM interesting_tags WHERE key IN ('created_by', 'ele', 'height', 'is_in', 'lanes', 'layer', 'maxspeed', 'name', 'ref', 'width') AND value IS NOT NULL;
DELETE FROM interesting_tags WHERE value IS NOT NULL AND key LIKE '%:%';
diff --git a/sources/master/update.sh b/sources/master/update.sh
index d030134..63814a1 100755
--- a/sources/master/update.sh
+++ b/sources/master/update.sh
@@ -35,10 +35,12 @@ $EXEC_RUBY -pe "\$_.sub!(/__DIR__/, '$DIR')" search.sql | sqlite3 $DIR/taginfo-s
rm -f $DATABASE
echo "`$DATECMD` Create master database..."
+min_count_tags=`../../bin/taginfo-config.rb sources.master.min_count_tags 10000`
+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 | sqlite3 $DATABASE
-$EXEC_RUBY -pe "\$_.sub!(/__DIR__/, '$DIR')" interesting_relation_types.sql | sqlite3 $DATABASE
+$EXEC_RUBY -pe "\$_.sub!(/__DIR__/, '$DIR').sub!(/__MIN_COUNT_TAGS__/, '$min_count_tags')" interesting_tags.sql | sqlite3 $DATABASE
+$EXEC_RUBY -pe "\$_.sub!(/__DIR__/, '$DIR').sub!(/__MIN_COUNT_RELATIONS_PER_TYPE__/, '$min_count_relations_per_type')" interesting_relation_types.sql | sqlite3 $DATABASE
echo "`$DATECMD` Updating history database..."
if [ ! -e $HISTORYDB ]; then