Skip to content
This repository was archived by the owner on Dec 13, 2024. It is now read-only.

Commit 46a5395

Browse files
author
thisisaaronland
committed
use a fixed list of relations to index
1 parent 02b6313 commit 46a5395

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ Go package for indexing Who's On First features in SQLite databases.
2323
Index the 'geometries' table (requires that libspatialite already be installed)
2424
-index-alt-files
2525
Index alt geometries
26-
-index-belongs-to
27-
Index the records listed in a feature's 'wof:belongsto' array. Alt files for 'wof:belongsto' are not indexed at this time.
28-
-index-belongs-to-uri string
29-
A valid go-reader.Reader URI from which to read data for a 'wof:belongsto' candidate.
26+
-index-relations
27+
Index the records related to a feature, specifically wof:belongsto, wof:depicts and wof:involves. Alt files for relations are not indexed at this time.
28+
-index-relations-reader-uri string
29+
A valid go-reader.Reader URI from which to read data for a relations candidate.
3030
-live-hard-die-fast
3131
Enable various performance-related pragmas at the expense of possible (unlikely) database corruption (default true)
3232
-mode string

cmd/wof-sqlite-index-features/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func main() {
5050
alt_files := flag.Bool("index-alt-files", false, "Index alt geometries")
5151
strict_alt_files := flag.Bool("strict-alt-files", true, "Be strict when indexing alt geometries")
5252

53-
index_relations := flag.Bool("index-relations", false, "Index the records related to a feature. Alt files for relations are not indexed at this time.")
53+
index_relations := flag.Bool("index-relations", false, "Index the records related to a feature, specifically wof:belongsto, wof:depicts and wof:involves. Alt files for relations are not indexed at this time.")
5454
relations_uri := flag.String("index-relations-reader-uri", "", "A valid go-reader.Reader URI from which to read data for a relations candidate.")
5555

5656
var procs = flag.Int("processes", (runtime.NumCPU() * 2), "The number of concurrent processes to index data with")

index.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,19 @@ func SQLiteFeaturesIndexRelationsFunc(r reader.Reader) sql_index.SQLiteIndexerPo
109109

110110
for _, path := range candidates {
111111

112+
// log.Println("RELATIONS", path)
113+
112114
rsp := gjson.GetBytes(body, path)
113115

114116
if !rsp.Exists() {
117+
// log.Println("MISSING", path)
115118
continue
116119
}
117120

118121
for _, r := range rsp.Array() {
119-
relations[r.Int()] = true
122+
id := r.Int()
123+
relations[id] = true
124+
// log.Println("MATCH", path, id)
120125
}
121126
}
122127

0 commit comments

Comments
 (0)