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

Commit c279297

Browse files
author
thisisaaronland
committed
index-belongs-to docs and tifying up, seems to work
1 parent 2cda2cc commit c279297

File tree

3 files changed

+27
-16
lines changed

3 files changed

+27
-16
lines changed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ Go package for indexing Who's On First features in SQLite databases.
77
### wof-sqlite-index-features
88

99
```
10-
./bin/wof-sqlite-index-features -h
11-
Usage of ./bin/wof-sqlite-index-features:
1210
-all
1311
Index all tables (except the 'search' and 'geometries' tables which you need to specify explicitly)
1412
-ancestors
@@ -23,18 +21,28 @@ Usage of ./bin/wof-sqlite-index-features:
2321
Index the 'geojson' table
2422
-geometries
2523
Index the 'geometries' table (requires that libspatialite already be installed)
24+
-index-alt-files
25+
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.
2630
-live-hard-die-fast
27-
Enable various performance-related pragmas at the expense of possible (unlikely) database corruption
31+
Enable various performance-related pragmas at the expense of possible (unlikely) database corruption (default true)
2832
-mode string
29-
The mode to use importing data. Valid modes are: directory,feature,feature-collection,files,geojson-ls,meta,path,repo,sqlite. (default "files")
33+
The mode to use importing data. Valid modes are: directory,featurecollection,file,filelist,geojsonl,metafile,repo,sqlite. (default "files")
3034
-names
3135
Index the 'names' table
36+
-optimize
37+
Attempt to optimize the database before closing connection (default true)
3238
-processes int
33-
The number of concurrent processes to index data with (default 16)
39+
The number of concurrent processes to index data with (default 8)
3440
-search
3541
Index the 'search' table (using SQLite FTS4 full-text indexer)
3642
-spr
3743
Index the 'spr' table
44+
-strict-alt-files
45+
Be strict when indexing alt geometries (default true)
3846
-timings
3947
Display timings during and after indexing
4048
```

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ 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_belongs_to := flag.Bool("index-belongs-to", false, "...")
54-
belongs_to_uri := flag.String("belongs-to-uri", "", "...")
53+
index_belongs_to := flag.Bool("index-belongs-to", false, "Index the records listed in a feature's 'wof:belongsto' array. Alt files for 'wof:belongsto' are not indexed at this time.")
54+
belongs_to_uri := flag.String("index-belongs-to-uri", "", "A valid go-reader.Reader URI from which to read data for a 'wof:belongsto' candidate.")
5555

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

@@ -217,8 +217,8 @@ func main() {
217217
record_func := index.SQLiteFeaturesLoadRecordFunc(record_opts)
218218

219219
idx_opts := &sql_index.SQLiteIndexerOptions{
220-
DB: db,
221-
Tables: to_index,
220+
DB: db,
221+
Tables: to_index,
222222
LoadRecordFunc: record_func,
223223
}
224224

index.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,19 @@ func SQLiteFeaturesIndexBelongsToFunc(r reader.Reader) sql_index.SQLiteIndexerPo
112112
return err
113113
}
114114

115-
if count == 0 {
116-
117-
ancestor, err := wof_reader.LoadFeatureFromID(ctx, r, id)
115+
if count != 0 {
116+
continue
117+
}
118118

119-
if err != nil {
120-
return err
121-
}
119+
ancestor, err := wof_reader.LoadFeatureFromID(ctx, r, id)
122120

123-
to_index = append(to_index, ancestor)
121+
if err != nil {
122+
return err
124123
}
124+
125+
to_index = append(to_index, ancestor)
126+
127+
// TO DO: CHECK WHETHER TO INDEX ALT FILES FOR ANCESTOR(S)
125128
}
126129

127130
for _, record := range to_index {

0 commit comments

Comments
 (0)