register.Rd
Register a directory on a shared filesystem for inclusion into the search index. This assumes that the directory is world-readable and the caller has write access to it.
register(dir, names, url, retry = 3, wait = 1)
On success, the directory is registered and NULL is invisibly returned. A warning is raised if any particular metadata file cannot be indexed.
# Start up an example SewerRat service:
info <- startSewerRat()
# Mocking up a directory:
tmp <- tempfile()
dir.create(tmp)
write(file=file.path(tmp, "metadata.json"), '{ "name": "Aaron" }')
# Once we register it, we can query its contents.
register(tmp, "metadata.json", url=info$url)
query("Aaron", url=info$url)
#> [[1]]
#> [[1]]$path
#> [1] "/tmp/RtmpJDU5Vu/file2175ea17d2d/metadata.json"
#>
#> [[1]]$user
#> [1] "root"
#>
#> [[1]]$time
#> [1] 1727971508
#>
#> [[1]]$metadata
#> [[1]]$metadata$name
#> [1] "Aaron"
#>
#>
#>
#> [[2]]
#> [[2]]$path
#> [1] "/tmp/RtmpJDU5Vu/file21746a1992b/metadata.json"
#>
#> [[2]]$user
#> [1] "root"
#>
#> [[2]]$time
#> [1] 1727971508
#>
#> [[2]]$metadata
#> [[2]]$metadata$first
#> [1] "Aaron"
#>
#> [[2]]$metadata$last
#> [1] "Lun"
#>
#>
#>
#> [[3]]
#> [[3]]$path
#> [1] "/tmp/RtmpJDU5Vu/file21710624f4c/metadata.json"
#>
#> [[3]]$user
#> [1] "root"
#>
#> [[3]]$time
#> [1] 1727971508
#>
#> [[3]]$metadata
#> [[3]]$metadata$first
#> [1] "Aaron"
#>
#> [[3]]$metadata$last
#> [1] "Lun"
#>
#>
#>
#> [[4]]
#> [[4]]$path
#> [1] "/tmp/RtmpJDU5Vu/file2175ada61e7/metadata.json"
#>
#> [[4]]$user
#> [1] "root"
#>
#> [[4]]$time
#> [1] 1727971508
#>
#> [[4]]$metadata
#> [[4]]$metadata$first
#> [1] "Aaron"
#>
#> [[4]]$metadata$last
#> [1] "Lun"
#>
#>
#>